Building apk with ant script.

I have come across a problem when creating an .apk file using ant script. The generated .apk with the name _unaligned.apk instead of the .apk and when I install the _unaligned.apk file on the device, I get a forced close showing java.lang.VerifyError exception, but the same apk generated using the IDE works fine. It struck me for a long time. Can you share the build.xml file that generates the .apk file?

+3
source share
3 answers

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

If you are looking for the actual build of the script, just take a look at your Android SDK / android-X / templates platforms. There should be a file named android_rules.xml.

I configured my build script to clean, build, sign and distribute apk on the connected device. If you want, I can provide you with my script. Just contact me!

+3
source

You will need to use zipalign and sign apk with some key; while you are testing the application, you can simply use the debug key withant debug

At least this is what I understand from this page , which you can carefully read.

+2
source

ant ?

I had various problems with manually running ant ( the apk repackage file to contain custom resources, which build tool to use ), and maybe some information about this thread will help you.

As an alternative, remember that you must sign the apk file before deploying it (see the Joubarc link).

0
source

Source: https://habr.com/ru/post/1751149/


All Articles