0

I have a project with some JNI libraries, the app works just fine with unsigned APKs, but when I generate a signed APK with the wizard, the app doesn't install and hit the error "App Not Installed".

To be clear, this is not the typical "uninstall the old APK with debug signature" case, I already done that. Could it be an error in the export wizard of eclipse?

I'm using Eclipse, and like I said I have some JNI libraries in it, apart from this, nothing uncommon, just a few library projects.

jh314
  • 27,144
  • 16
  • 62
  • 82
Edgar
  • 467
  • 1
  • 8
  • 23
  • Try installing it through ADB, and it will give you a more detailed error message. See: http://stackoverflow.com/questions/7076240/install-an-apk-file-from-command-prompt – Jonas Czech May 27 '15 at 14:17

1 Answers1

1

Signing Your App Manually You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK. To sign an app in release mode from the command line:

Generate 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 for passwords for the keystore and key, and to provide the Distinguished Name fields for your key. It then generates the keystore as a file called my-release-key.keystore. The keystore contains a single key, valid for 10000 days. The alias is a name that you will use later when signing your app.

Compile your app in release mode to obtain an unsigned APK.

Sign your app with your private key using jarsigner:

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

This example prompts you for passwords for the keystore and key. It then modifies the APK in-place to sign it. Note that you can sign an APK multiple times with different keys. Verify that your APK is signed. For example:

$ jarsigner -verify -verbose -certs my_application.apk

Align the final APK package using zipalign.

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

zipalign ensures that all uncompressed data starts with a particular byte alignment relative to the start of the file, which reduces the amount of RAM consumed by an app.

Jon Goodwin
  • 9,053
  • 5
  • 35
  • 54