How do I manually add a file to an Android APK package?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
An apk is a jar which is a zip. So you can use any tool that manipulates zips.
There is an added complication however: the Android platform requires all files in the apk (except for the files in the
META-INFdirectory) to be signed. So you need to call jarsigner again to sign all packages. You should then also call zipalign again.You must sign the modified apk with the same key that was used to sign the original apk. This is the whole point of the signature: it indicates that the package has not been tampered with without the approval of the signer. (Actually, you can sign with a different key, but then you won’t be able to access any data that was produced by the original application or vice versa.)
The ant scripts provided with the Android development kit contain automation to run jarsigner and zipalign.