gpt4 book ai didi

android - 运行 AOSP 测试

转载 作者:行者123 更新时间:2023-11-30 03:55:39 25 4
gpt4 key购买 nike

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

关于android - 运行 AOSP 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13401465/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com