1

I am attempting to generate a signed APK for my app. I'm using Android Studio to generate the release APK: build > generate signed APK. I then get a popup for my key store, alias, and passwords. This process has worked in the past but, I suspect, stopped working after a recent upgrade of tools and other support. What can I do to get Android Studio to generate the signed APK with a valid signature?

When I inspect the APK using jarsigner, from the Java 1.8 release, I get the message:

jar is unsigned. (signatures missing or not parsable)

If I use jarsigner to sign the app, it then installs on most devices but not on my device running Android 4.1. The command I used is:

jarsigner -verbose -keystore "...path...\perinote-release.keystore" app-release.apk perinote 

Further, if I add to the jarsigner options:

-digestalg SHA1 -sigalg MD5withRSA

it is accepted by the Android 4.1 device. I found these options in another post, no manifest. jar is unsigned. (signatures missing or not parsable), indicating that there was, at some point, a change in the encryption from SHA1 to SHA2.

Here is my build.gradle for "app"

apply plugin: 'com.android.application' android { signingConfigs { release { keyAlias 'perinote' storeFile file('...path.../perinote-release.keystore') } } compileSdkVersion 24 buildToolsVersion "25.0.0" compileOptions.encoding = 'UTF-8' defaultConfig { applicationId "com.perinote.camera" minSdkVersion 15 targetSdkVersion 24 renderscriptTargetApi 20 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.release } } lintOptions { checkReleaseBuilds false } } dependencies { compile 'com.android.support:support-v4:24.0.0' testCompile 'junit:junit:4.12' } 

What can I do to configure Android Studio to use SHA1 so that my app(s) will continue to work on Android 4.1 devices? Or is there something else I should be doing?

EDIT: I realize I should switch to SHA256. But I still need a way for my app to run on Android 4.1. Do I need to generate two versions and publish both of them?

2
  • Try and always use top level tags as well (added android and cryptography) and make sure your tags are correct (signature should be digital-signature) or your Q will go unnoticed. Commented May 28, 2017 at 15:11
  • Thanks. Those are great suggestions. Commented May 28, 2017 at 18:54

1 Answer 1

3

To get both signature versions, simply check the checkboxes for V1 and V2 at the bottom of the 2nd Generate signed APK dialog box.

I hadn't noticed this dialog changed after updating AS and blew right past it.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.