Building the apk using the ant script .

2020-03-05 02:47发布

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?

3条回答
Root(大扎)
2楼-- · 2020-03-05 03:27

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!

查看更多
何必那么认真
3楼-- · 2020-03-05 03:28

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.

查看更多
冷血范
4楼-- · 2020-03-05 03:31

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).

查看更多
登录 后发表回答