187

How do I export project in the Android Studio? I mean, like I used to do in Eclipse by File|Export..

Zoe
  • 27,060
  • 21
  • 118
  • 148
Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158

4 Answers4

318

Follow the below steps to sign the application in the android studio:-

  1. First Go to Build->Generate Signed APK

    First screenshot

  2. Then Once you click on the Generate Signed APK then there is info dialog message appear.

    Second screenshot

  3. Click on the Create New button if you don't have any keystore file. If you have click on the Choose Existing.

    This screenshot

  4. Once you click on the Create New button then now dialog box appear where you need to enter the keystore file info, other signing authority details.

    Fourth screenshot

  5. Once you fill complete details then click on the Ok button then it redirect to this dialog.

    Fifth screenshot

  6. Click on the Next button then check mark on the Run ProGuard and click on the finish. It generate the signed APK.

    Sixth screenshot

    Seventh screenshot

Ajay S
  • 48,003
  • 27
  • 91
  • 111
  • 1
    For whatever reason when i follow your instructions and try to upload my app to the play store it says that ive generated a debug apk. Any idea why that might be happening? Thanks! – sirFunkenstine Jan 17 '14 at 15:52
  • 1
    I have updated the answer and You have to add this in application tag android:debuggable="false" of AndroidManifest.xml – Ajay S Jan 19 '14 at 19:15
  • Hi TGMClans - I faced the same problem and tried adding the "android:debuggable="false"" but still generates a debug apk. please advise. – kAnNaN Feb 15 '14 at 19:15
  • 1
    I got the same problem. The "android:debuggalbe=false" doesn't work. – Bagusflyer Mar 13 '14 at 01:43
  • 12
    Now "android:debuggalbe=false" is not needed and you can select build type when exporting a signed APK. – echo Sep 04 '14 at 10:28
  • 4
    It's best to leave out the android:debuggable attribute from the manifest. If you do, then the tools will automatically insert android:debuggable=true when building an APK to debug on an emulator or device. And when you perform a release build, such as Exporting APK, it will automatically set it to false. If on the other hand you specify a specific value in the manifest file, then the tools will always use it. This can lead to accidentally publishing your app with debug information. `ANDROID STUDIO 0.8.14` – MCHAppy Dec 09 '14 at 21:54
  • FileNotFoundException when click on Okay. – Ejaz Karim Nov 07 '15 at 15:02
110

From the menu:

Build|Generate Signed APK

or

Build|Build APK

(the latter if you don't need a signed one to publish to the Play Store)

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158
  • 16
    For all the people who don't know where the created apk is : root_Of_Your_Application\app\build\outputs\apk\debug – Pero122 Mar 31 '18 at 21:55
10

Firstly, Add this android:debuggable="false" in the application tag of the AndroidManifest.xml.

You don't need to harcode android:debuggable="false" in your application tag. Infact for me studio complaints -

Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one less... (Ctrl+F1)

It's best to leave out the android:debuggable attribute from the manifest. If you do, then the tools will automatically insert android:debuggable=true when building an APK to debug on an emulator or device. And when you perform a release build, such as Exporting APK, it will automatically set it to false. If on the other hand you specify a specific value in the manifest file, then the tools will always use it. This can lead to accidentally publishing your app with debug information.

The accepted answer looks somewhat old. For me it asks me to select whether I want debug build or release build.

Go to Build->Generate Signed APK. Select your keystore, provide keystore password etc.

enter image description here

Now you should see a prompt to select release build or debug build.

For production always select release build!

enter image description here

And you are done. Signed APK exported.

enter image description here

PS : Don't forget to increment your versionCode in manifest file before uploading to playstore :)

Community
  • 1
  • 1
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
3

1.- Export signed packages:

  • Use the Extract a Signed Android Application Package Wizard (On the main menu, choose Build | Generate Signed APK). The package will be signed during extraction.

    OR

  • Configure the .apk file as an artifact by creating an artifact definition of the type Android application with the Release signed package mode.

2.- Export unsigned packages: this can only be done through artifact definitions with the Debug or Release unsigned package mode specified.

Alejandro Colorado
  • 6,034
  • 2
  • 28
  • 39