使用 ant 脚本构建 apk。

发布于 2024-09-06 12:55:00 字数 195 浏览 3 评论 0原文

我在使用 ant 脚本创建 .apk 文件时遇到问题。生成的 .apk 名为 _unaligned.apk 而不是 .apk,并且在将 _unaligned.apk 文件安装到设备时,我强制关闭,显示 java.lang.VerifyError 异常,但使用 IDE 生成的相同 apk 工作正常。对此我感触良久。您可以分享生成 .apk 文件的 build.xml 文件吗?

I am facing problem in creating the .apk file using the ant script . The generated .apk named as _unaligned.apk instead of .apk and on installing the _unaligned.apk file to the device I get force-close showing the java.lang.VerifyError exception, but the same apk generated using IDE works fine. I am struck on this for a long time. Can you share the build.xml file that generates the .apk file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如果没有你 2024-09-13 12:55:00

此 Bloq 条目 解释了所有必要的步骤。特别是如果您想自定义构建脚本。

如果您正在寻找实际的构建脚本,只需查看您的 Android SDK 文件夹platforms/android-X/templates。应该有一个名为 android_rules.xml 的文件。

我自定义了构建脚本来清理、构建、签名并将 apk 分发到连接的设备。如果您愿意,我可以为您提供我的脚本。请联系我!

this Bloq entry explains all necessary steps. Especially if you want to customize your build script.

If your are looking for the actual build script, just look into your Android SDK folder platforms/android-X/templates. There should be a file called android_rules.xml.

I customized my build script to clean, build, sign and distributing the apk to an attached device. If you like, I can provide you with my script. Just contact me!

携君以终年 2024-09-13 12:55:00

您需要使用 zipalign &用一些密钥签署你的 apk;只要您正在测试应用程序,您就可以简单地使用 ant debug 的调试键

至少这是我从 此页面,您可能需要仔细阅读。

You'll need to use zipalign & sign your apk with some key; as long as you're testing the app you can simply use the debug key with ant debug

At least that's what I understand from this page which you may want to read carefully.

豆芽 2024-09-13 12:55:00

您在命令/终端提示符下运行什么 ant 命令?

我在手动运行 ant 时遇到了不同的问题(重新打包 apk 文件以包含要使用的自定义资产和构建工具),并且该线程上可能有一些信息可以帮助您。

或者,请记住,在部署 apk 文件之前需要对其进行签名(请参阅 Joubarc 的链接)。

What ant command are you running at the command / terminal prompt?

I have been having different problems with manually running ant (Repackage apk file to contain custom assets what build tool to use) and there might be some info on that thread to help you.

Alternatively, remember that one needs to sign the apk file before deploying it (see Joubarc's link).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文