问题描述
如何测试一个应用程序,而在发布模式?我试图蚂蚁释放试验
,但它给了这个错误。
How do I test an app while in release mode? I tried ant release test
, but it gave this error
test:
[echo] Running tests ...
[exec] INSTRUMENTATION_STATUS: id=ActivityManagerService
[exec] INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for: ComponentInfo{com.kizbit.speedyreader.tests/android.test.InstrumentationTestRunner}
[exec] INSTRUMENTATION_STATUS_CODE: -1
[exec] android.util.AndroidException: INSTRUMENTATION_FAILED: com.kizbit.speedyreader.tests/android.test.InstrumentationTestRunner
我已经复制的密钥库测试项目。
I already copied the keystore to the test project.
我想,而在释放模式进行测试,因为它节省了大量的状态。在调试模式下,如果我重新安装,那么我必须卸载并重新安装,并删除所有的状态。
I want to test while in release mode, because it saves a lot of state. If I re-install in debug mode, then I have to uninstall and re-install it, and that deletes all the state.
推荐答案
好,我找到了一种方法。请务必在AndroidManifest.xml检查包名测试包和路径你的测试类。出于某种原因,在清单的包名称为COM ....测试,而类/ tests目录没有。我不知道它是如何工作过,但它用于正常调试工作。
Ok I found a way. Be sure to check the package name in the AndroidManifest.xml for the test package and the path to your test classes. For some reason, the package name in the manifest was com....tests, while the classes were not in /tests directory. I don't know how it ever worked, but it used to work for normal debug.
要获得它在释放模式测试,你必须使用蚂蚁版本安装测试
。我忘了安装。此外,测试
将永远构建应用程序的调试版本,所以你必须手动去到真正的应用程序项目的目录,然后运行蚂蚁版本安装
,这将安装发行版。然后,转到测试项目目录,然后运行蚂蚁版本安装测试
。这将给出错误
To get it to test in release mode, you have to use ant release install test
. I forgot the install. Also, test
will always build the debug version of your app, so you have to manually go to the real app project directory, and run ant release install
, which will install the release version. Then, go to the test project directory and run ant release install test
. This will give an error
Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]
当它试图安装的实际应用,因为它已经与释放键安装。您可以忽略这一点。此外,你必须用亚行卸载COM ........测试
删除测试项目的调试版本,以确保它不会给这个错误时,您尝试安装测试的发行版本。
when it tries to install the actual app, because it is already installed with the release key. You can ignore this. Also, you have to remove the debug version of the test project with adb uninstall com........tests
to make sure it doesn't give this error when you try to install the release version of the test.
此外,您还必须复制从实际项目目录到测试项目目录中的文件release.keystore,如果你有保存ant.properties你的钥匙,你必须将这些条目复制到测试ant.properties也
Also, you must copy the release.keystore file from the real project directory into the test project directory, and if you have your keys saved in ant.properties, you have to copy these entries into the test ant.properties also
key.store=release.keystore
key.alias=mykey
key.store.password=password
key.alias.password=password
然后,它会与发行版本测试!
Then it will test with the release version!
只要记住,因为它不安装应用程序的实际,你必须重新编译和手工从app目录重新安装发行版,如果你正在改变的事情。也许有一种方法来自动构建和放大器;通过修改build.xml文件安装发行版,但我还没有签成呢。
Just remember that since it doesn't install the actual app, you have to re-compile and re-install the release version manually from the app directory if you are changing things. Maybe there is a way to automatically build & install the release version by modifying the build.xml, but I haven't checked into that yet.
这篇关于在发布模式下测试应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!