How to see the Android Orchestrator log?

℡╲_俬逩灬. 提交于 2019-11-28 12:01:34
Turnsole

You'll find them on the device under /data/data/android.support.test.orchestrator/files/.

To get them off the device via ADB (requires debugging enabled and either a rooted device or an emulator so you have root):

adb root
adb pull /data/data/android.support.test.orchestrator/files/

Non-root, AndroidX users can use:

adb shell run-as androidx.test.orchestrator cat /data/user_de/0/androidx.test.orchestrator/files/com.pkg.name#testName.txt

My results show something slightly different than the other answers floating around SO.

Using Android Studio IDE

It seems that stock emulator images are basically rooted by default, except for images that support the Google Play Store. So try to run the failing test on a normal emulator and after you get the error I've been able to find the txt file through Android Studio's Device File Explorer tool.

Open the tool window and browse to /data/user_de/0/android.support.test.orchestrator/files/ and find your .txt file.

From here you can open the file or right-click to download it. No need to for any terminal adb root commands, etc.

Alternate method (command line)

If you insist on using adb and the command line then you must first:

adb root
adb pull /data/user_de/0/android.support.test.orchestrator/files/ [directory to save to]
adb unroot (optional)

Thoughts

Unfortunately if you were hoping for a stack trace or something useful in the .txt file you might be highly disappointed. All I found in my experience was something like:

INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0

which of course is quite useless for debugging. :(

I'm also not sure if the file location differs for actual devices since all the other answers out there say the file is located at /data/data/... instead of /data/user_de/... which is what I have found for emulators.

In my case the file was useless as it only had

INSTRUMENTATION_RESULT: shortMsg=Process crashed.
INSTRUMENTATION_CODE: 0

On the plus side, this informed me that my testing application crashed. Looking in the logcat showed the stack trace as to why it crashed.

For anyone who still stumbles upon this, this Stack Overflow answer was helpful. Pulling the files off of the emulator I was running required running adb as root first.

adb root

and then

adb pull /data/data/android.support.test.orchestrator/files/

For anyone using AndroidX Test Orchestrator, the path would change to

adb pull /data/data/androidx.test.orchestrator/files/

but, this command also found 0 files so I had to use

adb pull /data/user_de/0/androidx.test.orchestrator/

I was facing the same error and when I checked the txt file on the device, I did not find meaningful logs. Then, I changed the "Build Variant" in my Android Studio and the setup started working.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!