Sunday, January 3, 2016

Export Unsigned APK with Android Studio

For years I developed with eclipse and used the Android Tools option to Export Unsigned APKs.

[caption id="attachment_284" align="alignleft" width="300"]Eclipse Android Tools had an easy option to Export an Unsigned APK Eclipse Android Tools had an easy option to Export an Unsigned APK[/caption]

I could then take the unsigned .apk file and upload it to Amazon's developer console.

This was one of the last items I was still using eclipse for after over a year of Android Studio development.  I finally spent some time figuring out how to make the same thing happen without needing eclipse any longer.  I found many of the questions and answers on stackoverflow to be confusing and inaccurate.  For example, many seem to think that using the debug apk is the same as using the unsigned release apk...which is not accurate.

This is the comment that ended up helping me get it right:  http://stackoverflow.com/a/32202274/966122

Here's How to Export Unsigned APK in Android Studio


1. Edit the gradle build file for the project to specify an unsigned release signing.

buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}


releaseUnsigned.initWith(buildTypes.release)
releaseUnsigned {
signingConfig null
}

}

2. Generate Signed Apk using the releaseUnsigned Build Type.  This is on the 3rd or 4th screen in the flow of version 1.4 of Android Studio.

[caption id="attachment_286" align="alignleft" width="300"]Release unsigned apk in android studio Release unsigned apk in android studio[/caption]

Enjoy the Unsigned APK


Once the build finishes, there will be an unsigned apk in the location you specified. You can then upload that apk to an emulator or to Amazon to start the process of letting amazon sign the app.

No comments:

Post a Comment