Search code examples
androidapk

Deleting A File Within An APK Without Making The APK/App Unusable


Is it possible to include a raw resource in an APK (ex: strings.txt) and permanently delete it during runtime on the device the APK has been installed to? My understanding is that the original packaged APK must remain on the Android device untouched in order for the app to run properly. If the APK was unpacked and the strings.txt file deleted - could the APK be packaged again on the device and saved as the only APK file?


Solution

  • I'm afraid not, though I believe there is reason to do this -- prevent reverse engineering of our asset data.

    APK integrity is guaranteed by the signing process which uses the private key (jks). If you want to do Repackage, you will need the jks file at the user's device, this is absolutely not wanted.

    Google play store is trying to replace apk with app bundles which claims to reduce the download size of the application. In that case Play store will do the re-package for you but you have to rely on Play store to manage your private key.