Reputation: 479
I need to make hundreds flavors of my app. They have different logos and names. When I use android studio's productFlavor, it always OOM, and cost very long time to build hundreds app.
So I want to make these apps by apktool. decompile
, rebuild
, zipalign
, apksign
. But I find that, the finally generated apk can not be installed.
The error is:
Failure [INSTALL_FAILED_INVALID_APK: ed to extract native libraries, res=-2]
apktool d my_app.apk decompile
change the logo and name.
apktool b decompile my_app-rebuild.apk
zipalign -v 4 my_app-rebuild.apk my_app-align.apk
apksigner sign --ks my_key.jks --ks-pass pass:my_ks_pass --key-pass pass:my_key_pass --v1-signing-enabled true --v2-signing-enabled true --out my_app_out.apk my_app-align.apk
After these works, the my_app_out.apk can not installed.
Upvotes: 3
Views: 4004
Reputation: 31
From the error you got:
Failure [INSTALL_FAILED_INVALID_APK: ed to extract native libraries, res=-2]
If set to false
, then your native libraries must be page aligned and stored uncompressed in the APK.
It's either you need to set extractNativeLibs
flag to true
or you need to page align the apk when doing zipaligning by adding -p
parameter:
-p : outfile.zip
should use the same page alignment for all shared object files within infile.zip
The zipalign command should be:
zipalign -p -v 4 my_app-rebuild.apk my_app-align.apk
Upvotes: 3