Android Systrace: Unexpected error (Conversion = ';')
Asked Answered
A

1

10

I have been learning how to use Systrace following instructions on how to use Systrace (from the Android Developers website). I've tried using both the GUI and the Terminal (command line).

Using the GUI:

I received an error after the trace had finished and was being saved. I clicked on the 'Details' button and overall, was given the following message:

Unable to collect system trace

Reason: Unexpected error while collecting system trace.

Conversion = ';'

The Systrace file was not saved.

Using the command line:

I've tried using the command line as well using the GUI (although I'm new to using the command line).
Typing $ cd android-sdk/platform-tools/systrace or $ python systrace.py into the command line returns the error:

'$' is not recognized as an internal or external command, operable program or batch file.

Using cd android-sdk/platform-tools/systrace (without the $ character) gives this error:

The system cannot find the path specified.

And using python systrace.py (again, without the$ this time) returns this error:

'python' is not recognized as an internal or external command, operable program or batch file.

Am I missing something out, or is it something that needs to be reconfigured?

Ay answered 6/6, 2015 at 1:39 Comment(12)
Have you tried the command-line tools? developer.android.com/tools/help/systrace.html developer.android.com/tools/debugging/systrace.htmlMartines
@Martines I just tried that out. See my updated answer.Ay
The '$' indicates the command prompt, you don't type it. You need to switch to the root directory of the SDK before typing the commands. Search for a directory called "android-sdk" if you don't know where that is.Martines
@Martines Thanks. I switched to the root directory, but after switching, I tried typing python systrace.py --time=15 -0 myTrace.html sched view wm am res dalvik membus load, but I received the error 'python' is not recognised as an internal or external command, operable program or batch file.Ay
Sounds like you need to install a Python runtime.Martines
@Martines I already have Python installed. Do I need a specific version of it?Ay
Sounds like it's not in your PATH then.Martines
@Martines What exactly do you mean and how would I solve this issue? I have tried reinstalling Python with the option Add python.exe to Path (see this image), but I am still getting the same error when I run Systrace in Android Studio.Ay
The PATH is a list of directories that are searched for executable files. If the shell you're running is configured with a PATH that does not include python.exe (assuming Windows), then when you type "python" it doesn't know what to do. You can try typing the full path to the python executable, or you can figure out how your shell environment is configuring PATH and try to determine why it's unable to find python.exe.Martines
@Martines Thanks. It solved that particular error but I am now getting a different error (updated in answer)Ay
My first guess would be that the python executable is unable to find adb.exe in the PATH. The systrace script uses that to communicate with the device.Martines
@Martines Thank you so much! I finally fixed this issue. :DAy
A
5

I finally fixed my issue following @fadden's guidance in the comments.

I used the command prompt to find out what my issues were, but my problem was also fixed for the GUI. Here's how I did it:

  1. First, install Python if it's not already installed. I reinstalled it selecting the option: Add python.exe to Path (as in this image). I used Python 2 as I'm not sure how it would work with Python 3.

  2. Next, edit environmental variables. You can do this (on Windows 8) by going to Control Panel -> System -> Advanced System Settings -> Environment Variables. Under 'System variables', scroll down to 'Path' and click the 'Edit' button.

  3. Add Python to the Path by adding the address for the location of your Python installation followed by a semicolon to the start of the Variable value.
    For example, I added C:\Python27\; to the start of the 'Variable value'. (Note: Do not delete/remove anything from the 'Variable value' textbox, just add to it).

  4. Add adb.exe to Path as well by adding the address for the location of the file adb.exe similar to how you added Python to the path.
    It should be something similar to C:\Users\MyName\Android-SDK\platform-tools;.

  5. Click 'OK' on the dialogs and restart your computer for the changes to take effect. You should now be able to use Systrace using the GUI and command line without this error.

Ay answered 14/6, 2015 at 15:4 Comment(1)
@YetAnotherUser I already mentioned that though in step 1. If you mean that it has been downvoted because it only works with python 2, it should still not be downvoted as it is a solution to the question nonetheless.Ay

© 2022 - 2024 — McMap. All rights reserved.