Build Unsigned APK File with Android Studio

Build unsigned APK file with Android Studio

I would recommend you to build your APK file with Gradle:

  • Click the dropdown menu in the toolbar at the top (Open 'Edit Run/Debug configurations' dialog)
  • Select "Edit Configurations"
  • Click the "+"
  • Select "Gradle"
  • Choose your module as a Gradle project
  • In Tasks: enter assemble
  • Press Run

Your unsigned APK is now located in

ProjectName\app\build\outputs\apk

For detailed information on how to use Gradle, this tutorial is good to go: Building with Gradle in Android Studio. I also wrote a blog post on how to build an unsigned APK with Gradle.

If you moved your project from the other IDE and don't want to recompile, you may find your APK file that was already built in the IDE you moved from:

  • If you generated the Project with Android Studio, the APK file will be found in ProjectName/ProjectName/build/apk/...

  • Imported the project from eclipse: File should be in the same directory. Go to Project - Show in Explorer. There you should find the bin folder where your APK file is located in.

  • Imported from IntelliJ, the location would be ProjectName/out/production/...

Side note:
As Chris Stratton mentioned in his comment:

Technically, what you want is an APK signed with a debug key. An APK
that is actually unsigned will be refused by the device.

Generating unsigned, release apk with Android Studio

In the release build type, don't specify a signingConfig at all, and your build won't be signed. Release builds don't pick up the default signing config that debug builds get, so it should work for those.

There's a discussion on the adt-dev mailing list about it.

Bear in mind that to build from Android Studio, you'll need to go to the Gradle tasks window and choose the assembleRelease task; normal builds via "Make Project" don't actually build the final APK.

Android Studio can't generate an unsigned apk

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,'.

Unsigned Release APK not installing

First of all, it's not a bug.
Not allowing unsigned apks to install is one of security features. And unsigned apks have some use cases.

It's confusing but correct way ,for most of android app developers, to build a relase build, for public release, is Build -> Generate Signed Bundle / APK... .

Build -> Build Bundle(s) / APK(s) is for developpers and if signing setting is not set, it will generate unsigned apk. Signing setting can be set from File -> Project Structure... ->
Modules/app -> Signing tab and Build Types tab -> release -> Signing Config.

Unsigned apk can also be signed with tools other than Android Studio. Publishers like Google, Amazon etc also do like this. They sign (wrap) apks with signatures other than the signatures which developpers have signed. "When to sign" is separated from build process, but it doesn't mean allowing unsigned apks to install on devices.

There are developper tools like apksigner, and it's one of tools. Developpers have rights to select signing tools. Unsigned apks are for them, I think.

Just for knowledge:

Some guys seems to find a way to temporally disable such security features like this.



Related Topics



Leave a reply



Submit