I want to replace one file in the assets folder with generated apk(in the assets folder there is sample.txt file after generating the apk i want to change the data in that file and regenerate the new apk ).
===> old APK+modified(sample.txt)=newApk
How to do this?
To edit the files inside, you'll need to decompile (and then recompile) the package using APKtool on a computer. Editing APK files requires knowledge of Java, as well as the file systems on both Windows and Android. This should only be done by advanced users.
Assets provide a way to add arbitrary files like text, XML, HTML, fonts, music, and video in the application. If one tries to add these files as “resources“, Android will treat them into its resource system and you will be unable to get the raw data. If one wants to access data untouched, Assets are one way to do it.
An APK file contains all of a program's code (such as .dex files), resources, assets, certificates, and manifest file. As is the case with many file formats, APK files can have any name needed, but it may be required that the file name ends in the file extension for being recognized as such.
An APK file is a ZIP archive, and assets are not modified as part of the build process. So, on your development machine, you can:
jarsigner
to sign the APK with your production keystorezipalign
to align the results on four-byte boundaries for faster loading at runtimeIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With