While installing a SuperHexagon APK which I bought from Humble Bundle a couple of years ago I encountered an error. The package installer simply stated “App not installed”, a logcat got me some more information:
Trying to install it via adb install didn’t help either:
I did some research and finally found the problem. The HumbleBundle Android version of SuperHexagon hasn’t aged well, the APK is configured to install on SD card. This simply doesn’t work on my First Generation Moto G which doesn’t even have a SD card slot. So I did some more reasearch and found the solution. Of course this will most likely work for other applications with the same error too.
You will need those three applications installed:
The Android SDK will be needed for signing the rebuilt APK
The APK tool will help us unpacking the original APK
As this is a tutorial for advanced users, I assume you managed to install those.
I’m writing the tutorial for Windows, it’s not a lot different for Linux of course.
First, we need to fix the erroneous configuration setting which is located within the Apps AndroidManifest.xml.
Unpack the APK:
Edit the AndroidManifest.xml and change android:installLocation="preferExternal" to android:installLocation="auto".
Repack the APK:
Now we fixed the error. Sadly, our app will most likely not be able to install as it’s not signed anymore. That’s what we do now. The Android developer documentation does a good job explaining it, so I make it short.
Generate a private key for signing the application. You'll find the needed keytool.exe in the bin directory of the JDK.
There's no real need entering any real data here, just press Enter and choose any password.
Sign the fixed APK with your newly created key via jarsigner.exe which is also located in the JDKs bin directory.
If you want, you can verify that the APK was signed correctly.
Afterwards zipalign the APK to ensure the best performance.
That’s it, you’re done. You can now transfer this APK to your device and install it without hassle.