iTranslated by AI
Creating a Mod APK to run armeabi-v7a apps on arm64-v8a devices
Background
I wanted to try running a 9-year-old Android app. Since it was still available on F-Droid, I installed it and tried to run it, but it didn't work properly due to a runtime error.
Looking at the source code, it seemed to be built only for armeabi-v7a. When I pulled out a Nexus 5 and installed it, it ran without issues.
This suggested that it would likely work if built for arm64-v8a as well. However, even with the source code available, setting up a build environment for something from 9 years ago is quite challenging. I realized that armeabi-v7a (32-bit) and arm64-v8a (64-bit) are compatible, and it should be possible to run it on arm64-v8a if the armeabi-v7a *.so files are loaded properly. So, I decided to try creating a mod apk to make it work.
What is a mod apk?
It refers to modifying an APK file to achieve various things.
This ranges from swapping assets to replace textures—similar to PC game mods—to modifying the source code to change how the app behaves.
It is used to add convenient features to existing apps, or in the case of games, as a method for cheating.
While there are sites that distribute various mod apks, you never know what might be bundled inside them, so you should absolutely avoid installing ones you just happen to find online.
Creating a mod apk
First, I'll download the APK from F-Droid and extract it. The file structure looks like this:
.
├── AndroidManifest.xml
├── LICENSE-2.0.txt
├── assets
│ └── huga
│ ├── hoge.so
│ ├── foo.so
├── classes.dex
├── lib
│ └── armeabi-v7a
│ ├── bar.so
│ ├── baz.so
│ ├── piyo.so
│ └── hage.so
├── res
...
As expected, lib/armeabi-v7a exists, but lib/arm64-v8a is missing, so it seems like it will work if I create it and copy the .so files over.
So, I'll use a software called APK Tool to extract and modify the APK.
Extracting the APK file
apktool d input.apk -o output_folder
input.apk is the name of the APK file you want to extract, and output_folder is the name of the output folder.
Once extracted, create lib/arm64-v8a and copy the contents of lib/armeabi-v7a into it.
Rebuilding it back into an APK
apktool b output_folder -o new_apk_file.apk
output_folder is the extracted folder, and new_apk_file.apk is the name of the new APK file you want to generate.
This creates the modified APK, but since modern versions of Android cannot install unsigned APKs, I'll sign it.
If you don't have a keystore file yet, create one:
keytool -genkey -v -keystore my-release-key.keystore -alias my_alias -keyalg RSA -keysize 2048 -validity 10000
Signing
jarsigner -verbose -keystore my-release-key.keystore -signedjar signed_new_apk_file.apk new_apk_file.apk my_alias
my-release-key.keystore is the keystore file, signed_new_apk_file.apk is the name of the new signed APK file, new_apk_file.apk is the generated APK file, and my_alias is the keystore alias.
Now I have an APK file that can be installed.
Trying it out
When I actually installed it on a newer device (Galaxy Z Fold2) and tried running it, the runtime error no longer occurred, and the app worked successfully.
Discussion