且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在发布模式下测试应用程序

更新时间:2023-01-02 20:33:41

好,我找到了一种方法。请务必在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.