我正在尝试运行一些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$ 有人能帮上忙吗?
发布于 2013-10-25 23:20:27
当我尝试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
https://stackoverflow.com/questions/13401465
复制相似问题