1

我正在尝试运行一些 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$ 

任何人都可以帮忙吗?

4

1 回答 1

1

当我尝试 4.2.2 时,我也遇到了同样的问题。但是,我在 4.3 上工作时没有问题。谷歌搜索后,我意识到问题是由 apk 和 odex 引起的。在 4.2.2 中,测试被编译成 apk 和 odex,这意味着 apk 不包含 classes.dex。odex 文件包含所有类。当你只“adb install apk”时,这实际上会导致失败,因为 pm 找不到 classes.dex。

解决这个问题的方法是LOCAL_DEX_PREOPT := false在 Android.mk 中添加。这会将 dex 放回 apk。我已经在 4.2.2 full-eng 中尝试过了。

该线程还提供了一些信息。https://groups.google.com/forum/#!topic/android-building/OrBJsS2J3sw

于 2013-10-25T15:20:27.180 回答