Android Performance: Course Documentation

Performance Profiling Tools Documentation

Tool: Hierarchy Viewer

Tool: Profile GPU Rendering

Tool: Debug GPU Overdraw

Tool: Batterystats & Battery Historian

Tool: Traceview

Tool:  Systrace

Tool: Memory Profilers

Troubleshooting Tips & FAQ

Android Studio does not find my phone

gradle or runProguard() Error when building pre-Android Studio 1.0 legacy app

Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]

Hierarchy Viewer: "DdmViewDebugDevice]Timed out waiting for profile data" when profiling Sunshine

Systrace: “unexpected error while collecting system trace” error

Importing Legacy Apps into Android Studio 1.1.0 (Using Sunshine 1 as the Example)

What you need

Steps for Importing Sunshine into Android Studio 1.1.0

Performance Profiling Tools Documentation

Performance Profiling Tools landing page

Tool: Hierarchy Viewer

Device Setup for Hierarchy Viewer

Hierarchy Viewer Walkthrough

Profiling with Hierarchy Viewer

Tool: Profile GPU Rendering

Profiling GPU Rendering Walkthrough

Profiling GPU Rendering Codelab

Tool: Debug GPU Overdraw

Debug GPU Overdraw Walkthrough

Debug GPU Overdraw Codelab

Tool: Batterystats & Battery Historian

Batterystats & Battery Historian Walkthrough

Battery Historian Charts

Tool: Traceview

Traceview Walkthrough

Tool:  Systrace

Systrace Walkthrough

Tool: Memory Profilers

Heap Viewer, Memory Monitor, and Allocation Tracker are complementary tools that visualize the memory your app uses.

  1. Use the Memory Monitor to find out whether undesirable garbage collection (GC) event patterns might be causing your performance hiccups.
  2. Run Heap Viewer to identify candidate object types.
  3. Use Allocation Tracker to identify where in your code the problem might be

Check out the full comparison of memory tools.


Troubleshooting Tips & FAQ

Android Studio does not find my phone

gradle or runProguard() Error when building pre-Android Studio 1.0 legacy app

Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]

Hierarchy Viewer: "DdmViewDebugDevice]Timed out waiting for profile data" when profiling Sunshine

Systrace: “unexpected error while collecting system trace” error 

Android Studio does not find my phone

gradle or runProguard() Error when building pre-Android Studio 1.0 legacy app

Importing Legacy Apps into Android Studio 1.0

Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]

If you see this message while deploying your app:

Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]

When trying to deploy Sunshine to your mobile device, you may need to manually uninstall the version of the app that's on on your device, then deploy again.

Note that this may happen when deploying Sunshine 2 onto the original Sunshine 1.

See more generic info on Stackoverflow.

Hierarchy Viewer: "DdmViewDebugDevice]Timed out waiting for profile data" when profiling Sunshine

Systrace: “unexpected error while collecting system trace” error


Importing Legacy Apps into Android Studio 1.1.0 (Using Sunshine 1 as the Example)

What you need

Steps for Importing Sunshine into Android Studio 1.1.0

Dependencies and Prerequisites:

Download Android Studio

Ability to download from github.com

Related Information:

Using Hardware Devices

Importing some pre-Android-1.0 projects into Android 1.0 or newer can trigger a series of errors. This document shows you how to resolve them, using a version of the Sunshine app used in the Android Fundamentals Udacity Course as an example. 

CAVEAT: As with all documentation of this kind, the details are likely to vary for each application and each update of Android Studio.

What you need

Steps for Importing Sunshine into Android Studio 1.1.0

  1. Download Sunshine ZIP from GitHub:
    https://github.com/udacity/sunshine/tree/6.10-update-map-intent
    (I
    f you are having any problems with Android Studio or the app, use the following version, or your own app, to follow along with the example.
    https://github.com/udacity/sunshine/tree/3.13-add-share-action-provider)
  2. Unzip the application to extract the code folder.
  3. Start Android Studio. (This works best if you close all projects, then restart.)
  4. Click Import project (Eclipse ADT, Gradle, etc.).  

Screen Shot 2015-02-23 at 9.21.56 AM.png

  1. In the popup, find and select the Sunshine-6-10-updated-map-intent folder and click OK.

  1. If prompted, choose a destination folder for your project. If prompted to choose a build system, choose Gradle. (These prompts vary, depending on your project and Android Studio version.) If you need more guidance, see this Lynda tutorial.
  2. Wait for the import to complete. If you see no errors, you are now ready to work with your app.

    If you get a gradle error:
  3. If you get a gradle error, you have some extra work to do. (Because the Import didn’t finish, at this point, you may only see the Gradle Scripts directory in your Project view.)
  4. You may see the link “Install missing platform(s) and sync project”, or a link to install missing build tools. Click whatever link and proceed.
  5. The next time through, your build will fail with:

  1. Click the “Fix plugin version and re-import project” link in the error message.
    This will rebuild the app and present you with new of errors.

 

  1. Click the “Gradle Settings” link in the error message.
  2. Check the Use auto-import and click OK.
  3. Expand the project hierarchy and find the build.gradle file.The file you are looking for is not the one showing at the top level, but the one inside
    Sunshine > app > build.gradle, as shown below.

  1. Double-click the build.gradle file.
  2. Make the following changes to the file:

Your file should look like this:

  1. Save (Ctrl-S).

For the following two messages (Steps 18/19), what you see might vary. You might  see either message or both messages in sequence. Click the appropriate links to continue until the Language Level Changed dialog opens.

  1. In the code view bar, click the “Try again” link.  
  2. If you see these warnings, click the “Sync now” link.


  1. In the Language Level Changed dialog, click Yes.

    And
    if you get the Gradle Running dialog, Yes again.

  2. After the project reloads, run the app on your device. (If it crashes the first time, try again, and it will run.)