Publishing an App Inventor App on the Android Market.
  • ToxigenicpoemToxigenicpoem December 2010

    An EASY HowTO to get your app published and on the market in under 10 minutes (as long as your internet connection does not suck.)


    Make sure you have all the tools


    Pre Step: Note You Can Skip This Step If You Already Sign Android Applications For The Market
    To Sign android applications for the market you will need a Private Key, used by jarsigner in the Java JDK. This is the basic process to create a KeyStore - I will not list every Operating System here, this is a very basic explanation for Windows Users.

    Pre.A: CD to the JDK/bin path. (c:\program files\sun\jdk 1.6\bin)

    Pre.B: Run the following command to create a key to sign your apps with for release on the market. Hint: Change the AliasName to something easy to       remember. You can also change the keystore name to create. Once this file is created, BACK IT UP, its good practice not to lose the key :) .

    keytool.exe -genkey -v -keystore my-release-key.keystore -alias aliasname -keyalg RSA -keysize 2048 -validity 10000

    Step 1: Create your application in App Inventor, go through your paces with testing and get something ready you want to publish and release to the masses. Don't start this tutorial to make a Whack A Nerdy game ;-), give us something good! Do all the work to make your app in App Inventor. Including icon work etc.

    Step 2: Package your application to Download to the Local Computer.

    Step 3: Open a Command Window/Terminal Window. With the Unpacked apkTool we will decompile the APK without decompiling source. The apk will be extracted into the the directory you are currently in. I recommend creating a folder and dumping APKTOOL into it, as well as your APK you are working on. Then CD into that directory and run the command.

    APKTOOL d -s YOURAPKNAME.apk

    Step 4: Edit the Manifest, this will be located in a folder with the same name as your APK, the file is called AndroidManifest.xml this is the guy that isn't being built correctly. We need to add a few Attributes, Remove one, and Move one, and add a tag. Lets begin! 

     4.a
    <manifest package="appinventor.InventorName.AppName"
     xmlns:android="http://schemas.android.com/apk/res/android"
       android:versionCode = "1"
       android:versionName = "1.0"
        android:installLocation="auto">

    You need to add the portions that are bolded, to the MANIFEST tag. versionCode and versionName are required for Android Market to                           determine   the   versioning of your application, this is used when pushing out updates for your app, modify them if this is an update.
    installLocation is used to allow your app to be placed on the SD Card for Froyo+ users.

     4b. You need to specify which version of Android your application will run on Minimally. Add the following line directly below the                                Manifest Tag (the one we worked on above). You can find a list of SdkVersion and Android Versions here
       <uses-sdk android:minSdkVersion="3" />

    4c. Now we need to fix a broken Icon Reference, or App Market will spit on your submission! Currently the line looks something like this.
      <activity android:label="AppName"  android:icon="@drawable/ya"  android:name=".Screen1">

     
    Cut  the attribute android:icon="@drawable/ya" so that it is no longer in that line. Then paste it into the line below, and remove   android:debuggable at the same time.

                      <application android:label="AppName"  android:debuggable="true">

     
    Your new manifest should look like this.

    <?xml version="1.0" encoding="UTF-8"?>
    <manifest package="appinventor.InventorName.AppName"
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:versionCode = "1"
      android:versionName = "1.0"
      android:installLocation="auto">
    <uses-sdk android:minSdkVersion="3" />
      ..
            <application android:label="AppName" android:icon="@drawable/ya">
            <activity android:label="AppName"  android:name=".Screen1">
                ..
            </activity>
         ..
        </application>
    </manifest>


  • ToxigenicpoemToxigenicpoem December 2010


    Step 5. Rebuild the application, starting in your command window from the same parent directory of YOURDECOMPILEDAPP run the following command against apktool
    APKTOOK b YOURDECOMPILEDAPPDIRECTORY YOURAPPOUTPUT.APK

    Now you should have a nice apk. If you opened it in a ZIP program you would be missing a META-INF folder, so we are still not done, but we are close! 

    Step 6. Sign your application. CD to the JDK/bin path. (c:\program files\sun\jdk 1.6\bin) and run the following command. Be prepared to provide the password you used to generate the keystore in the prestep. Obviously substitute your keystore if you already sign apps for the market. Make sure you change the aliasname and keystore name if you modified them from the prestep, modify apkname.apk to point to your APK.

    jarsigner.exe -verbose -keystore  my-release-key.keystore apkname.apk aliasname

    If you want to verify the the sign was ok

    jarsigner.exe -verify -verbose -certs apkname.apk

    Step 7 Almost done! Lets ZipAlign the APK

    cd to the AndroidSDK\tools directory. (you should have generally installed this to c:\android\tools) then run the zip align command

    zipalign -v 4 input.apk output.apk

    Step 8 Now take the output.apk and upload it to Google App Market, Share your creation!

    faqs.  

    Q Why is my install failing from the market? It complains it isn't properly signed.
    A Uninstall your testing version that you installed from App Inventor. 

  • louizbdlouizbd December 2010

    app inventor app... nice =D

  • blasphemous24blasphemous24 December 2010

    Can app inventor be used to sell apps if your app gets enough praise ?

  • ToxigenicpoemToxigenicpoem December 2010

    Following the steps above to submit the app tot he market, allows you to sell the app. 

  • BeeBee December 2010

    So when I type in this command line--->keytool.exe -genkey -v -keystore my-release-key.keystore -alias aliasname -keyalg RSA -keysize 2048 -validity 10000  I get an error message of aliasname is not a legal command and a bunch of other things.  Any ideas so I can continue?

  • ToxigenicpoemToxigenicpoem December 2010

    @bee give this a shot


    keytool.exe -genkey -v -keystore my-release-key.keystore -alias aliasname -keyalg RSA -keysize 2048 -validity 10000

  • 2momo1232momo123 December 2010

    On step five, when doing the APKTOOl b YOURDECOMPILEDAPPDIRECTORY YOURAPPOUTPUT.APK

    I get an error code. Attached, is a picture of this code.
    I would greatly appreciate it, if you could help me.
    Thank You.
    image

  • ToxigenicpoemToxigenicpoem December 2010

    What are you building? Why is it called Launcher :) doesn't look like an app inventor app to me.

  • SamSam December 2010

    Thanks for putting these instructions up. I can confirm they work. Got my app in the store now. Cheers :)

  • nickstewartg1nickstewartg1 December 2010

    Was going to ask the same thing Toxic ;)

  • jomebrewjomebrew December 2010

    in windows 7, the keystore file failed to create:


    keytool error: java.io.FileNotFoundException: jomebrew.keystore (Access is denied)
    java.io.FileNotFoundException: my-keystore.keystore (Access is denied)
            at java.io.FileOutputStream.open(Native Method)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
            at sun.security.tools.KeyTool.doCommands(KeyTool.java:902)
            at sun.security.tools.KeyTool.run(KeyTool.java:172)
            at sun.security.tools.KeyTool.main(KeyTool.java:166)

    I omitted the -keystore my-keystore.keystore which creates the keystore in \users\<username>\.keystore.

  • mkeywoodmkeywood January 2011

    Hi,


    Awesome tutorial. Thanks :)


    Niave question here, but I take it need to create an Android Developer profile (and pay the $25 etc) via this: http://market.android.com/publish/signup


    Cheers


    Martin

  • ToxigenicpoemToxigenicpoem January 2011

    Hi martin sorry for my lack of activity. You do need a developer account to upload the file to the market. @jomebrew Glad you got the command issue worked out.

  • mkeywoodmkeywood January 2011

    Thanks so much for the quick response. I'll sign up now then :)


    Cheers


    Martin

  • RaptorCodeRaptorCode January 2011

    This is an excellent article and much thanks for putting it up here.  The only thing that I had a problem with was realizing that the repacked APK needed to be moved to the ..JDK\bin directory and the AndroidSDK\tools directory prior to running each command prompt on steps 5 and 7.  THANKS!

  • RyFlyRyFly January 2011

    Does this work on a Mac as well? I'm not a developer yet but am trying to follow along. Having trouble figuring out what to do with the Java JDK. I have downloaded it and the Android SDK to and APK Tool to desktop, but not sure if that is the right spot for them and which to use to make the code changes above. Sorry to be a n00b, but I'm trying to learn. Thanks.

  • ToxigenicpoemToxigenicpoem January 2011

    hi RyFly, these instructions were written while on a Windows Box, I can update them tonight to include Mac Instructions. The only real difference is the command for creating a KeyStore.


    I will note, that you can always Test Sign you application. While this is not the best method of securing your applications distribution, it can be substituted for using a private key.

  • dtathonydtathony January 2011

    Hey Toxigenicpoem,



    I'm an ultra novice too, I've never written a single line of code before.. I was wondering what signing the app means? Also how easy would this whole 8-step process be considering I have no code knowledge at all??

    Drew

  • MBeersMBeers January 2011

    I get  Market requires that the certificate used to sign the apk be valid until at least October 22, 2033. Create a new certificate.


    Where do I edit the date?

    Thank you.

  • severalseveral January 2011

    Great stuff Toxicgenicpoem, thanks so much for posting this.  Worked on my first try.  (app name is: Shakespeare's Monologues.)  It isn't truly an app yet, but will be when it grows up. :-)

  • ToxigenicpoemToxigenicpoem January 2011

    @mbeers did you miss this swtich when making the key -validity 10000   it sets the date far far into the future. 


    @dtathony signing the app is a form of security and authentication for the market place, Once sign an app can never be updated or replaced unless signed again. This whole process should fairly easy for everyone.

  • amerkashiamerkashi February 2011

    Hi, I developed a tool called AppToMarket that automates this process. You can see images, doc, or download here: http://amerkashi.wordpress.com/2011/02/14/automating-conversion-of-app-invertor-apk-to-google-market/

    M. Hossein Amerkashi

  • seandavid1seandavid1 February 2011

    To perform step 3 on Windows Vista 64-bit, i had to type APKTOOL.jar into the command prompt. Simply typing APKTOOL returned an error. FYI.

  • seandavid1seandavid1 February 2011

    Thanks for the awesome tutorial, though.

  • ToxigenicpoemToxigenicpoem February 2011

    @seandavid1 if you needed to type APKTOOL.JAR, you missed the download for your Operating Systems wrapper. There is a separate download needed based on the OS to keep the command the same. 

    Also note, you can no longer Test Sign market applications.

  • mkamoskimkamoski February 2011

    All - Kindly ignore this message because I re-read your article and see that you have already covered my question. Thank you. - Mark Kamoski

  • sonnysekhonsonnysekhon February 2011

    Hi Toxigenicpoem,

    I too got this error:

    keytool error: java.io.FileNotFoundException: mykey.keystore (Access is denied)

    But as advised by jomebrew, I omitted the -keystore my-keystore.keystore and was able to get my .keystore file.

    But I can't sign using the jarsigner command. 

    I moved the .keystore and my apk to the bin folder.
    It gives me an error:

    C:\Program Files\Java\jdk1.6.0_24\bin>jarsigner.exe -verbose -keystore .keystore
    myapk.apk aliasname
    Enter Passphrase for keystore:
    jarsigner: unable to create: myapp.apk.sig
    Any ideas? Any help would be much appreciated.

  • cazzajaycazzajay February 2011

    Hi

    Great tutorial - very clear!

    I am having a problem with the manifest edits above and was wondering if anyone can help.  My manifest file seems to be different to the above example to start with, my modifications have: 

    <?xml version="1.0" encoding="UTF-8"?>
    <manifest android:versionCode="2" android:versionName="2.0" android:installLocation="auto" package="appinventor.ai_orcomma.APPNAME"
      xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.VIBRATE" />
        <uses-sdk android:minSdkVersion="3" />
        <application android:label="APPNAME" android:icon="@drawable/ya">
            <activity android:name=".Screen1" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name="com.google.devtools.simple.runtime.components.android.ListPickerActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation" />
            <activity android:name="com.google.devtools.simple.runtime.components.android.WebViewActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                </intent-filter>
            </activity>
        </application>
    </manifest>

    but I get an error - the "application force close" one.

    Any ideas?

  • cazzajaycazzajay February 2011

    sonny, I had this Permission Denied problem - try moving the JDK folder in its entirety to the root of C. Its to do with the way Windows 7 makes the folder Administrator Only (read only etc)

  • sonnysekhonsonnysekhon February 2011

    You're my hero cazzajay. I can't thank you enough :). I spent all day yesterday, banging my head against the wall.

Hey are you new here?!

Welcome to the best Ad-Free Android Community around! Create your profile, and start posting now! New features are being added all the time!

Login with Facebook Sign In with OpenID Sign In with Google Sign In with Twitter

Sign In! Sign Up!

Categories

In this Discussion

Tagged