Skip to content Skip to sidebar Skip to footer

How To Add Resource File To Android Apk After Compilation And Build Of Apk?

Is it possible to add a .class java-class file or if that's not possible a .txt text-file to an APK after it has been built and without source code? We compile and build an Android

Solution 1:

The good news is that an APK file is just a zip file, so it's pretty easy to manipulate files that inside it.

The bad news is that you can add a .class file but Android will not be able to use it... that's because Android uses a different format (Dex) and expects code to be in Dex files instead of plain Java bytecode...

If you wanted to include a custom .txt file then all you'd have to do is copy it to the assets/ directory inside of the APK. Files in this folder are can be extracted to your applications internal folders, so it should be pretty easy to load it directly from there. But don't forget that tinkering with an APK file will invalidate its signature, meaning that you'll have to re-sign that APK in order to install it via an app store.

Post a Comment for "How To Add Resource File To Android Apk After Compilation And Build Of Apk?"