28

I usually create projects with Eclipse and import them into Android Studio, because I hate the project structure AS gives me. In it´s module settings, I have the possibility to create artifacts which allow me to output the built apk to a certain path.

enter image description here

Now I have created a Gradle project directly with AS and it seems that those projects have quite less options than eclipse projects. I don´t find anything to output my apk and I don´t find any apk inside my project folder after building.

enter image description here

How do I get my unsigned apk out of the build process??

Marian Klühspies
  • 15,824
  • 16
  • 93
  • 136

6 Answers6

51

Use

Build > Make Project

to build an apk file from Android Studio.

You can get your unsigned apk under the below path

$YOUR_PROJECT/$YOUR_MODULE/build/apk

unsigned apk files will have "unsigned" text in their names.

[ UPDATE ] :

In Recent release of Android Studio you will not get apk file on sysncing or Make Project. There are two other methods in order to get the apk file

  1. Run the app
  2. Execute assemble Task from Gradle panel present in right hand side of Studio window or from embedded terminal window on bottom(in project Root)

gradlew assembleDebug(or whatever build varient you want a build for)

and the update new apk path will be

$YOUR_PROJECT/$YOUR_MODULE/build/outputs/apk

This has been done by Android Tools team to improve the Android Studio performance.

Piyush Agarwal
  • 25,608
  • 8
  • 98
  • 111
  • 6
    `Make Project` no longer seems to build an apk as of Android Studio 0.8. – InsanityOnABun Jul 11 '14 at 01:54
  • 4
    Not as of Android Studio 0.8, It was removed in 0.5.4 or 0.5.3. Now Make project only compiles the code and create R.java (if required) nothe the gradle tasks. So i order to create apk file you have to run the respective gradle task like assembleDebug from command line or by double clicking on the right listed task in right hand panel. – Piyush Agarwal Jul 11 '14 at 14:23
  • I will update the answer after confirming the version soon, Right now in office busy with some work enjoy. – Piyush Agarwal Jul 11 '14 at 14:24
  • 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 or build via command line (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 and/or point me in the right direction? many thanks – cjayem13 Aug 15 '14 at 17:25
  • I don't see this in 1.0.2. I do see an -unaligned.apk – Tom Kincaid Jan 25 '15 at 19:29
  • I have updated my answer, thanks for getting my notice on this. – Piyush Agarwal Jan 27 '15 at 10:10
  • Be aware: Android Studio hides the output folder in the project view, but it exists! Check http://stackoverflow.com/q/25131515/813951 – Mister Smith Feb 13 '15 at 12:18
  • Your outdated answer still works with the latest android studio. – sam100rav May 03 '15 at 20:03
  • There is no $YOUR_PROJECT/$YOUR_MODULE/build/apk directory, (AS 2.2 Preview 5) and using assembleDebug creates a debug signed apk which is not an unsigned apk, build/outputs/apk is debug signed – behelit Jul 19 '16 at 05:52
  • @behelit Please check the Update section in recent releases it is moved to $YOUR_PROJECT/$YOUR_MODULE/build/outputs/apk . – Piyush Agarwal Jul 21 '16 at 03:08
25

The above answer of pyus13 did not work for me (Android Studio 0.8.1).

Instead use

Run > Run "YourProject"

to build the code and create the unsigned apk. You can find your apk file under

$YOUR_PROJECT/$YOUR_MODULE/build/outputs/apk

UPDATE

Still works with Android Studio 1.5.1 You only get new APKs when you have code changes since you last built your code.

kaolick
  • 4,817
  • 5
  • 42
  • 53
  • @Wayfarer What exactly did not work for you? Which version of Android Studio are you running? Why did you downvote my answer? – kaolick Sep 19 '14 at 21:57
  • 1
    `apk` found after `run/run` in the mentioned directory `/build/outputs/apk` - confirmed in version "Android Studio 1.0 RC 4" - nevertheless I found 2 apks: `app-debug.apk` and `app-debug-unaligned.apk` - don't know the diff between them :D – Xavi Montero Dec 08 '14 at 23:18
  • 1
    Can't edit my own comment. Just use `app-debug.apk` and discard the `app-debug-unaligned.apk` version as that is only an intermediate step to build the aligned one. – Xavi Montero Dec 09 '14 at 00:02
  • When I try to sign app-debug.apk I get "jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size" – Tom Kincaid Jan 25 '15 at 19:35
  • @TomKincaid This has probably nothing to do with the topic discussed here. A simple Google search brings you to this post: http://stackoverflow.com/questions/5089042/ – kaolick Jan 26 '15 at 07:51
  • 1
    The output folder only had debug signed apk for me. This post is how I got a truly unsigned apk: http://entzeroth.com/export-unsigned-android-apk/ – Keith Entzeroth Jan 14 '16 at 19:12
  • @BeritLarsen Yes, it does (see update above). Just tested it myself with version 1.5.1 Please try it again. – kaolick Apr 19 '16 at 18:09
19

Open Gradle panel, open the tasks list of your project and double click on BUILD task, then under " -> build -> outputs -> apk" you will find your unsigned APK with name -release-unsigned.apk

Stefano
  • 3,127
  • 2
  • 27
  • 33
3

As of Android Studio 1.5 you can now generate an APK using

Build > Build APK

Which you can then find under

$YOUR_PROJECT/$YOUR_MODULE/build/outputs/apk.

Edit: New Android Studio gives this Path:

$YOUR_PROJECT/$YOUR_MODULE/build/outputs/apk.
bbodenmiller
  • 3,101
  • 5
  • 34
  • 50
3

It is also possible to build an apk by using the command line (Android Terminal).

  1. Choose the Terminal in Android Studio - very bottom next to Android Monitor and Version Control
  2. Build apk with command Windows: gradlew.bat assembleRelease Mac: ./gradlew assembleRelease
  3. Find unsigned apk file - /app/build/outputs/apk/app-release-unsigned.apk

Tested in Android 1.5

user3889585
  • 217
  • 2
  • 6
1

Edit app.gradle buildTypes block, set

signingConfig null

Then rebuild.

liruqi
  • 1,524
  • 15
  • 12