Ege Kuzubasioglu
Ege Kuzubasioglu

Reputation: 6282

Android Studio can't generate an unsigned apk

I built an app and I want to generate an unsigned .apk for that.

Build > Build APK

Gradle build runs and finishes without any error but when I check

Build > outputs > apk

path, I can't see any unsigned apk folder, only app-debug-unaligned.apk and app-debug.apk exist.

Upvotes: 0

Views: 3860

Answers (1)

Maher Abuthraa
Maher Abuthraa

Reputation: 17834

Quick answer .. You should select release buildVariant then use build apk to get unsigned-apk .. otherwise by default you are using debug buildType which using debug keystore for signing apk ..

Unsigned apk cannot be installed on any device/emulator unless it is signed

So using build apk on:

Debug buildType will sign apk with debug keystore

Release builtType will produce unsigned.apk ..

Both are available on [project dir]/app/build/outputs/apk/

FYI: Why Android studio doesn't sign release builType implicitly as debug?

Thats done on purpose to prevent developers to use debug keystore by mistake to sign apk as release buildType which may go to play store ..

You have two solutions to sign release:

  1. (Easier) Go to build (menu) ==> generate Signed APK and then create once a keystore then use it to sign apk.
  2. If you want achieve that by command so update build.gradle to guide compiler to your own keystore . my favorite approach is here : https://facebook.github.io/react-native/docs/signed-apk-android.html Then use (for step #2)

    ./gradlew assembleRelease
    

    to have signed apk with your own keystore

I hope that may help,'.

Upvotes: 2

Related Questions