Adb - [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION]

When I change files in the extracted APK, I re-zip it, change the extension to .apk and install like this:

$ adb install CustomAPK.apk 
2831 KB/s (41896599 bytes in 14.450s)
    pkg: /data/local/tmp/CustomAPK.apk
Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION]

      

What it is?

This is not the same as the other, I had to sign the APK with the alias "cert". As a second answer to "duplicate".

+3


source to share


1 answer


Generate key and sign apk: Android developer site



Signing your application manually

You don't need Android Studio to sign your application. You can sign your application from the command line using standard tools from the Android SDK and JDK. To sign an application in release mode from the command line:

Create a private key using keytool. For example:

$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

This example prompts you to enter passwords for the keystore and key and provide the Distinguished Name fields for your key. It then generates the keystore as a file named my-release-key.keystore. The key store contains one key that is valid for 10,000 days. An alias is a name that you will use later when signing your application.

Compile the app in release mode to get the unsigned APK. Sign your app with a private key using jarsigner:

$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name

This example prompts you to enter passwords for the key store and key. He then modifies the APK in place to sign it. Note that you can sign the APK multiple times with different keys.

Make sure your APK is signed. For example:

$ jarsigner -verify -verbose -certs my_application.apk

Align the final APK with zipalign.

$ zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk

zipalign ensures that all uncompressed data starts at a specific byte alignment relative to the beginning of the file, which reduces the amount of RAM consumed by the application.

+3


source







All Articles