我正在尝试运行一些AOSP测试,但除了cts之外我无法运行任何测试。我提到我试图用模拟器做这个。这是我终端的输出:
manuel@banstyle:~/aosp/development/testrunner$ ./runtest.py -v core
Building tests...
about to run adb shell cat /data/local.prop
about to run adb shell ls -l /data/local.prop
about to run adb root
ONE_SHOT_MAKEFILE="frameworks/base/tests/CoreTests/Android.mk" make -j16 -C "/home/manuel/aosp" all_modules
about to run adb shell pm list instrumentation | grep android.core/android.test.InstrumentationTestRunner
Error: adb shell pm list instrumentation | grep android.core/android.test.InstrumentationTestRunner returned 1 error code
Could not find instrumentation android.core/android.test.InstrumentationTestRunner on device. Try forcing a rebuild by updating a source file, and re-executing runtest.
Exiting due to AbortError...
manuel@banstyle:~/aosp/development/testrunner$ ./runtest.py -v calculator
Building tests...
about to run adb root
ONE_SHOT_MAKEFILE="packages/apps/Calculator/Android.mk" make -j16 -C "/home/manuel/aosp" all_modules
adb push /home/manuel/aosp/out/target/product/generic/data/app/CalculatorTests.odex data/app/CalculatorTests.odex
about to run adb push /home/manuel/aosp/out/target/product/generic/data/app/CalculatorTests.odex data/app/CalculatorTests.odex
adb install -r /home/manuel/aosp/out/target/product/generic/data/app/CalculatorTests.apk
about to run adb install -r /home/manuel/aosp/out/target/product/generic/data/app/CalculatorTests.apk
32 KB/s (2699 bytes in 0.080s)
pkg: /data/local/tmp/CalculatorTests.apk
Failure [INSTALL_FAILED_DEXOPT]
about to run adb shell pm list instrumentation | grep com.android.calculator2.tests/android.test.InstrumentationTestRunner
Error: adb shell pm list instrumentation | grep com.android.calculator2.tests/android.test.InstrumentationTestRunner returned 1 error code
Could not find instrumentation com.android.calculator2.tests/android.test.InstrumentationTestRunner on device. Try forcing a rebuild by updating a source file, and re-executing runtest.
Exiting due to AbortError...
manuel@banstyle:~/aosp/development/testrunner$
有人可以帮忙吗?
答案 0 :(得分:1)
当我尝试4.2.2时,我也有同样的问题。但是,当我在4.3上工作时,我没有这个问题。谷歌搜索后,我意识到问题是由apk和odex引起的。在4.2.2中,测试被编译成apk和odex,这意味着,apk不包含classes.dex。 odex文件包含所有类。当你只“adb install apk”时,这实际上会导致失败,因为pm找不到classes.dex。
解决此问题的方法是在Android.mk中添加LOCAL_DEX_PREOPT := false
。这将把dex放回apk。我在4.2.2 full-eng中尝试了这个。
这个帖子也提供了一些信息。 https://groups.google.com/forum/#!topic/android-building/OrBJsS2J3sw