23

I want to submite an application to Google Market. I found there is only one apk file generated in a project, its path is Project1Project/Project1/build/apk/Project1-debug-unaligned.apk

It looks like it's a debug version. Where do I find (if any) a release version of an application or how do I generate it?

hoss
  • 2,430
  • 1
  • 27
  • 42
Alan Coromano
  • 24,958
  • 53
  • 135
  • 205

4 Answers4

26

Since Android Studio is based on IntelliJ, that's how to do it in IntelliJ:

Build -> Generate Signed APK

and provide it with your key and its password.

Mohsen Afshin
  • 13,273
  • 10
  • 65
  • 90
  • do I really need a signed apk? I don't want to sell it. – Alan Coromano Jul 14 '13 at 08:32
  • 1
    Yes, you need it. You need to have valid apk signed by your specific key set. The debug apps (apk) are signed by a fixed debug key. The procedure: http://stackoverflow.com/questions/4853011/how-to-sign-an-android-apk-file – Mohsen Afshin Jul 14 '13 at 12:33
  • Why do I get *Application x (process com.x.y) is waiting for the debugger to attach)* when I run the installed apk that has been generated just the way you mentioned? – Saeed Neamati Aug 09 '15 at 11:56
  • @SaeedNeamati, you are running in debug mode and the debugger must be attached before running your app. Something prevents debugger from attaching. A restart in either side may help. – Mohsen Afshin Aug 09 '15 at 13:11
16

You can build an unsigned release version. See the answer here. I don't see an easy way to do it from the GUI, but you can use the shell command:

./gradlew assembleRelease

Make sure to cd to your project's directory before running the command. This will produce the file

Project1Project/Project1/build/apk/Project1-release-unaligned.apk

If you run ./gradlew assemble, both the release and debug version will be built.

More documentation here.

Cœur
  • 37,241
  • 25
  • 195
  • 267
zim
  • 516
  • 8
  • 8
3

From Android Studio 1.3.1, the ready-to-publish apk location is :

app -> app-release.apk

This should be published to Google Play

Intermediate apks are at :

app -> build -> outputs -> apk -> app-release-unaligned.apk

This is Intermediate result of Signing process, should not be published to Google Play

Kushal
  • 8,100
  • 9
  • 63
  • 82
1

Android gradle produces apk in two binaries: Unaligned and Aligned. Unaligned refers to how the data, files are structured within the APK file. A utility called zipalign modifies the APK to align data in a way that is optimized for users. Unaligned simply skips the zipalign stage.

Whereas an Aligned APK is an optimized version. The files are more structured and compressed, which helps the app run faster. They are also optimized for RAM usage so they can consume less RAM on the devices. you will also see size difference in the APK generated.