Android 构建脚本错误的解决方法
Android 提供了一个系统来自动生成测试项目的构建脚本。非常酷...只有两个问题。
- 当测试失败时,构建始终声称成功。
- 测试要求您在运行
run-tests
目标之前启动模拟器;这些脚本无法自动启动/停止模拟器。
你真的在使用Android测试脚本吗?如果是这样,您如何解决这些问题?你会让模拟器一直运行吗?阅读构建失败的日志?我还需要了解其他解决方法吗?
Android provides a system to autogenerate build scripts for a test project. Pretty cool... there's just two problems with it.
- The build always claims to succeed when the tests fail.
- The tests require you to start an emulator before you run the
run-tests
target; the scripts provide no way to automatically start/stop the emulator.
Are you actually using the Android test scripts? If so, how do you workaround these problems? Do you leave an emulator running all the time? Read the logs for build failures? Are there other workarounds I need to know about?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们在 Android 项目中广泛使用 ant 构建脚本,并且自定义了 ant 脚本。如果您查看 /tools/ant 文件夹,您将看到一个名为 main_rules.xml 的文件(我认为可从 android 2.3 获得)。这是主文件,包含执行构建的所有目标,包括启动模拟器。您需要做的是将目标有选择地提取到您的 build.xml 文件中,并修改它们以满足您自己的需要。
通过这种方式,您可以自定义构建的几乎所有内容。这大约需要 2-3 天的任务,但好处是多方面的。它还可以帮助开发人员更多地了解应用程序是如何构建的,这总是一件好事。
We use ant build scripts extensively for our android projects and we custom rolled the ant scripts. If you look in /tools/ant folder, you will see a file called main_rules.xml (available from android 2.3 on I think). This is the main file and has all the targets to do the builds, including launching the emulator. What you need to do, is to extract targets selectively into your build.xml file, and modify them to suit your own needs.
Doing it this way will allow you to customize pretty much everything for builds. This is about say 2-3 day task, but the benefits are manifold. It also helps developers know more about how the app is built, which is always a good thing.