Does IntelliJ IDEA publish an Android app with one click?

14,822

Solution 1

New IDEA versions have an option to generate unsigned APK in the Android Facet settings, Compiler tab:

Generate unsigned APK

However you don't need to do that if you use the Export Signed Android Package feature:

Tools | Android | Export Signed Android Package will generate the release version of your application signed with the release key and ready for Market.

You can also create a batch file that will sign the unsigned APK and configure it as an External Tool in IDEA so that you can generate it in one click or via keyboard shortcut (if you are OK with a batch file containing your keystore passwords in open text).

I use such script to generate the signed APK, upload it to a phone and start the main Activity to perform application testing, it has the following sequence of actions:

  1. jarsigner
  2. zipalign
  3. adb install
  4. adb start

EDIT 2013/2/8: The option to export a Signed APK is now under Top Menu > Build > Generate Signed APK (IntelliJ IDEA 12)


IDEA 12 has even better way to do it via artifact, configured like this:

artifact

Then use Build | Build Artifacts when you need to make a release version.

Solution 2

Well you could modify the ant scripts slightly and have one target which builds a final signed APK. So that technically could be a one click build. Not sure about publishing, you may be restricted to using the web interface to upload and publish the app.

I wrote a tutorial on publish, it might be worth a read as I cover some of the building final releases and such

Share:
14,822
sandalone
Author by

sandalone

A developer since 1999, started with Java. A freelancer since 2009, and a client hiring freelancers since 2011. Have been using Android Studio and Gradle since 0.1.

Updated on June 19, 2022

Comments

  • sandalone
    sandalone about 2 years

    On Android developer's page (http://developer.android.com/guide/publishing/app-signing.html) there is a tutorial on publishing which says that an app has to be compiled as an unsigned app, a private key must be generated with keytool then signed with jarsigner.

    How do we create an unsigned app with IntelliJ?

    Alternatively, can we do all these steps via Tools->Android->Export Signed Android Package?

    Thanks in advance!

  • sandalone
    sandalone about 13 years
    Thanks for a tip on batch files. I'm on my own computer so storing passwords in a text file is not a problem at all. However, I think that option Export Signed Android Package is far more convenient and for the time being I will use it. However, this tip on batch files is REALLY great and I will consider it seriously.
  • sandalone
    sandalone about 13 years
    Thanks for a tip but I'm looking for the simplest way to get publish-ready APK and I think this built-in command is such way.
  • lordmegamax
    lordmegamax over 10 years
    Thanks very much! You save a lot of my time!
  • Riddhi Shah
    Riddhi Shah over 10 years
    hey where this key store is stored . I can not find this key store.
  • CrazyCoder
    CrazyCoder over 10 years
    @RiddhiShah this keystore file is created by you, so only you know where you've placed it. You can find more details in Android documentation.
  • Riddhi Shah
    Riddhi Shah over 10 years
    I am new user of intellij idea so i don't know and I usually use this command for generate key. keytool -exportcert -alias androiddebugkey -keystore C:\Users\Riddhi\.android\debug.keystore -list -v
  • CrazyCoder
    CrazyCoder over 10 years
    @RiddhiShah it's not IDE specific.
  • Riddhi Shah
    Riddhi Shah over 10 years
    I need to create keystore new . can u give me steps or any hint then i can find or create certificate
  • CrazyCoder
    CrazyCoder over 10 years
    @RiddhiShah I've already provided you a hint in the first reply: developer.android.com/tools/publishing/…
  • turner
    turner about 8 years
    there is no 'Android' option in my tools context menu