开发者

Writing to Android APK

开发者 https://www.devze.com 2023-03-05 23:47 出处:网络
Is it possible to modify the contents of an APK (add a fil开发者_如何学JAVAe) after it has been signed and zipalign\'ed?

Is it possible to modify the contents of an APK (add a fil开发者_如何学JAVAe) after it has been signed and zipalign'ed?

I would like to save some information in the archive rather than on the phone. Is this possible, or would this only work with non signed debug builds?

Thanks


You can't modify an .apk that is installed on the device. Even modifying it after signing is tricky since it can be easy to end up with an invalidate .apk that is no longer signed correctly.


apks are basically zip type files. You can open them with 7zip (and probably many other zip utilities, this just happens to be the one I use) My gut instinct though is that if you paste a new file into it. It is no longer going to install and run properly. But that being said I've never tested it. Is it your own apk you are trying to add to? If so why not put whatever you need in there before you compile and sign it?


Your application is installed to /data/app (internal memory) and you don't have permissions to write anything there. Or if your application is installed on sdcard, it will be installed into a special partition, and you won't have write access there too.

If you want to modify apk after it's signed (but not yet installed to device) you need to re-sign it. There is no way to add a file to apk, and then make it installed without re-signing.

0

精彩评论

暂无评论...
验证码 换一张
取 消