319

I'm developing an Android app with the Android Developer Tool. Now I tried the new Android Studio, everything works fine if connect my smartphone with the PC and directly run the program in the Android Studio. But now I want to test the program with other smartphones without connecting them to my PC.

The ADT creates the .apk file under "projectname/bin" every time you compile the program. How I see it at the moment, Android Studio doesn't do that.

So, my question is: Is it possible to create an unsigned .apk file with Android Studio?

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
klange
  • 3,465
  • 3
  • 16
  • 16

17 Answers17

372

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.

bpoiss
  • 13,673
  • 3
  • 35
  • 49
  • 1
    Yes i imported the project from eclipse. But i my case the bin folder isn't touched by the Android Studio. With a bit searching i found it by my self. In my case the .apk was located in "projectname/out/production/projectname/" – klange May 23 '13 at 09:58
  • This should be only in case if you switched from IntelliJ – bpoiss May 23 '13 at 12:44
  • 9
    I am generating the project directly with Studio but there is no folder named "bin" in any of the folders of the project. And in "build" folder there are only two folders namely "res" and "source" and no "bin" folder. can you suggest me something now? – Himanshu Aggarwal Jun 22 '13 at 12:41
  • I am in the same situation as Himanshu, but my "build" folder leads to an "intermediates" folder. But no "bin." – Daniel Jun 19 '14 at 03:06
  • Fyi, under project structure you may need to go modules - choose app - locate build/apk - and include in build. Mine was excluded by default so when I searched project folders build/apk was missing. If excluded, to include simply highlight folder and click red exclude icon to reinclude again. – cjayem13 Aug 15 '14 at 17:11
  • A plain `assemble` builds all variants and flavors. Looking at the contents of META-INF, they're all signed. What if I want to run jarsigner manually? – kaay Oct 05 '16 at 06:54
  • 37
    `Click the dropdown menu in the toolbar at the top` This is so general. What dropdown menu? What toolbar? – dthree Nov 25 '17 at 00:00
  • 4
    @dthree you can click "Run" on the top menu bar, and select "Edit Configurations" from the dropdown – Gema Megantara Apr 09 '18 at 19:31
  • How to implement flavors? – Mahdi Dec 03 '18 at 12:42
  • For me `.apk` file obtained this way failed to install, with `InstallAppProgress: Installation error code: -15` in logcat and contentless error essage displayed in UI. – reducing activity Nov 20 '19 at 22:24
  • i got his error 'Could not set process working directory to 'C:\Users\marad\.gradle\daemon\5.2.1\My Application': could not set current directory (errno 2)' – ass-king some questions Jun 22 '20 at 07:46
  • In Tasks: enter `assemble` means, where I need to do? – Harsha May 28 '21 at 06:13
235

According to Build Unsigned APK with Gradle you can simply build your application with gradle. In order to do that:

  1. click on the drop down menu on the toolbar at the top (usually with android icon and name of your application)
  2. select Edit configurations
  3. click plus sign at top left corner or press alt+insert
  4. select Gradle
  5. choose your module as Gradle project
  6. in Tasks: enter assemble
  7. press OK
  8. press play

After that you should find your unsigned 'apk' in directory ProjectName\app\build\outputs\apk

Community
  • 1
  • 1
marcin
  • 2,945
  • 2
  • 12
  • 13
  • 1
    + edit build.gradle with android { lintOptions { checkReleaseBuilds false abortOnError false } [....] } and it works! thank you – Steffi Feb 08 '15 at 21:08
  • Thank you marcin ... It worked.. One thing to notice is I could not find "outputs/apk" folder in the Android Studio.. It only appeared in the file system.. – Govind Feb 14 '15 at 03:06
  • Task 'assemble' not found in root project 'bin'. – nVentimiglia Aug 10 '15 at 19:23
  • 2nd vote. This should be the Correct Answer. I had this problem on a clean android studio install with project import. You have to go through this manual setup to get any apk files from a build. – rickfoosusa Sep 01 '15 at 15:46
  • It works in 1.5.1, but actually build whole project apks even if single module has been selected. – sandrstar Apr 01 '16 at 05:28
  • You need to go out of the src folder in Android Studio. – Zirui Wang Jan 06 '18 at 09:13
  • For me `.apk` file obtained this way failed to install, with `InstallAppProgress: Installation error code: -15` in logcat and contentless error essage displayed in UI. – reducing activity Nov 20 '19 at 22:25
99

The easiest way, I guess:

  • Open Gradle tab on the right side
  • Double click YourProject/:app/assemble (or assembleDebug)
  • You'll find the apk here
    .../YourProject/app/build/outputs/apk/app-debug.apk

screenshot

Andrew
  • 36,676
  • 11
  • 141
  • 113
54

just go to BUILD->Build APK and it's done

Aakash Bansal
  • 707
  • 5
  • 12
  • 12
    +1. A VERY simple method. BTW, you can find the generated APK at `AndroidStudioProjects//app/build/outputs/apk/debug/app-debug.apk` – Spikatrix Jun 04 '18 at 07:59
  • 1
    as simple as that, thank you very much, it worked, appreciate it. – Zeyad Apr 10 '19 at 01:17
24

AndroidStudio 3.4


After Grade Build Running complete, you will see the notification at bottom-right corner like.

Click on locate and you will see your debuggable APK

Linh
  • 57,942
  • 23
  • 262
  • 279
21

Step 1 Open android studio . Build -> Generate Signed APK… . now click on “Generate Signed APK”.

enter image description here

Step 2

enter image description here

Click Create new.

Step 3

Fill the details and click ok. enter image description here

jks key details,It will go back to previous window.

enter image description here

Click Next, and give the password which you stored in key.

Step 4

enter image description here

Now click Finish and wait to complete the building process.

enter image description here

Now apk generated successfully. Click show in Explorer.

enter image description here

If you need more details please visit and check the live demo http://javaant.com/how-to-make-apk-file-in-android-studio/#.VwzedZN96Hs

Nirmal Dhara
  • 2,121
  • 18
  • 27
20

In Android Studio:

  1. Build

  2. Build APK(s)

  3. Wait and go to the location shown in a pop-up window. On right bottom side

enter image description here

Andrii Kovalchuk
  • 4,351
  • 2
  • 36
  • 31
14

Yes, it is possible to create an unsigned .apk with Android Studio!

Highlight the Project in your package explorer or project column, and then File - Project Structure - Artifacts - + - Android Application - From module 'your app' and then you can change the location and some other options. I enable build on make, just for ease.

schott12521
  • 231
  • 2
  • 15
  • it is popping up the message "We will provide a UI to configure project settings later. Until then, please manually edit your build.gradle file(s.)" Now what should i do? – Himanshu Aggarwal Jun 22 '13 at 12:35
  • 8
    and what if I don't have any “Artifacts” there? – squirrel Jul 05 '14 at 19:54
  • Hit the plus sign in the top left and you can get to Android Application – CACuzcatlan Jul 30 '14 at 06:57
  • http://www.jetbrains.com/idea/webhelp/artifacts.html what is the point of using artifacts? I thought it was to generate an unsigned apk debug apk, etc but it seems as if you can simply go to the build/apk folder to get the unsigned apk so long as you run assemblerelease from gradle menu (at least in intellij IDE). I just configured an artifact but I'm having trouble figuring out what to truly do with it. Can someone please help clarify the difference and use or point me in the right direction? – cjayem13 Aug 15 '14 at 17:24
  • @cjayem13 Some projects don't use Gradle. – Marc Plano-Lesay Nov 23 '15 at 15:13
14
Build -> Build APK     //unsigned app


Build -> Generate Signed APK  //Signed app
Siva Prakash
  • 4,626
  • 34
  • 26
12

With Android Studio 2.2.3 on OSX I just used the top menu:

Build > Build APK

It opened Finder with the .apk file. This won't generate a signed APK. You can select Generate Signed APK from the same menu if needed.

pascal
  • 757
  • 1
  • 7
  • 8
10

Just go to Your Application\app\build\outputs\apk

and copy both to phone and install app-debug.apk

WhiteWolfza
  • 225
  • 3
  • 7
5

For unsigned APK: Simply set signingConfig null. It will give you appName-debug-unsigned.apk

debug {
     signingConfig null
}

And build from Build menu. Enjoy

For signed APK:

signingConfigs {
        def keyProps = new Properties()
        keyProps.load(rootProject.file('keystore.properties').newDataInputStream())
        internal {
            storeFile file(keyProps.getProperty('CERTIFICATE_PATH'))
            storePassword keyProps.getProperty('STORE_PASSWORD')
            keyAlias keyProps.getProperty('KEY_ALIAS')
            keyPassword keyProps.getProperty('KEY_PASSWORD')
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.internal
            minifyEnabled false
        }
        release {
            signingConfig signingConfigs.internal
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

keystore.properties file

CERTIFICATE_PATH=./../keystore.jks
STORE_PASSWORD=password
KEY_PASSWORD=password
KEY_ALIAS=key0
Qamar
  • 4,959
  • 1
  • 30
  • 49
4

Following work for me:

Keep following setting blank if you have made in build.gradle.

signingConfigs {
        release {
            storePassword ""
            keyAlias ""
            keyPassword ""
        }
    }

and choose Gradle Task from your Editor window. It will show list of all flavor if you have created.

enter image description here

CoDe
  • 11,056
  • 14
  • 90
  • 197
3

--- Create new config in signingConfigs

unsigned {
        //do not sign
    }

--- Create build type in buildTypes

unsigned {
        versionNameSuffix '-unsigned'
    }

--- Go to build variants and chose unsigned standard. Build project.

--- Go to "outputs/apk" and find "XXX-unsigned.apk". To check if it is unsigned try to install it to device - you'll fail.

sharky
  • 57
  • 1
  • 2
  • This does not work. You need to define the signinigConfig a bit different (taken from http://stackoverflow.com/a/18121401/624109) `signingConfigs{ unsigned{ storePassword = "" keyAlias = "" keyPassword = "" } }` – Muzikant Jan 08 '15 at 09:02
1

Now in Android Studio v1.1.0 should be:

  1. select Run > Run <your app>
  2. find .apk file in <your app>\build\outputs\apk
John Jang
  • 2,567
  • 24
  • 28
1

Android studio also create the apk file on every time compile the program, just go to your workspace folder and find app->build->outputs-> then you can see the apk file.

0

You can click the dropdown near the run button on toolbar,

  1. Select "Edit Configurations"
  2. Click the "+"
  3. Select "Gradle"
  4. Choose your module as Gradle project
  5. In Tasks: enter assemble

Now press ok,

all you need to do is now select your configuration from the dropdown and press run button. It will take some time. Your unsigned apk is now located in

Project\app\build\outputs\apk