To start off, if you have great aspirations for marketing your applications to others make sure to sign up for a developer account and pay the one time fee of $25 USD. This will ensure that not just anyone is publishing to the market. If your not looking to shell out the money then you can continue with the tutorial and give anyone who wants your app the file to put on their SD card. Whether you decide to do this step or not we still need to version our application. We are going to use the EnhancedQuotes Project for this example. We are going to open up the Android Manifest in enhanced quotes and put some code in here so we can version our application.
Versioning an application means that we make the application able to accept updates if something breaks or we are adding more features. Once the Android Manifest is open we are going to modify the line where it says
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gregjacobs.enhancedquotes" >
and add in
<android:versionCode=”1” android:versionName=”1.0” >
so that the line should look like
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.gregjacobs.enhancedquotes" android:versionCode=”1” android:versionName=”1.0”>
This tells the device we run the app on that this is version one and anything that comes along that is higher will be upgraded. We need to add in a minSDKVersion as well so the Android Market can tell which devices can use our application. We need to add
<uses-sdk android:minSdkVersion="3" />
underneath the /application node that will be shown below. We also want to add a specific icon so that our application stands out from all the other ones on a persons device. I chose this icon and saved it to an easy to find place, naming it icon.png, then dragging onto the drawable folder in res/. Eclipse will ask you if you would like to overwrite, just say yes.
keytool -genkey -v -keystore C:/MyKeygen.keystore -alias MyKey -keyalg RSA -keysize 2048 -validity 10000.
Now that we have the command entered we can step through and determine what each of these variables is doing for the keytool.
- -genkey – Initiates the start of the making a key pair.
- -v – Enables output to be shown to the user making the keystore.
- -keystore – After this variable will contain the location and the name of the keystore we are going to make.
- -alias – Gives the keystore a shorter name or nickname if you will.
- -keyalg – This is the type of encryption used and can be either RSA or DSA encoded.
- -keysize – The size of each key that is generated. This is recommended to be at least 2048 bits or higher as stated by Google. The default is 1024 bits.
- -validity – The number of days the key is valid. This should be no less than 10000 but is recommended to go higher.
We are now ready to sign the application and get it ready for deployment to the Android Market. We do this by going to eclipse and in the Package Explorer right click on EnhancedQuotes, go to Android Tools then click Export Signed Application Package…. This will open up a dialog box asking you the project you want to export, click next as the one we want is selected. Now we want to click the browse button on this page and locate our keystore file we created earlier, make sure to enter the password for it and click next. Choose the alias we created for it and enter the same password as before and click next. Now choose the destination for the APK file we are about to create, I am choosing the C Drive. Click Finish and the APK file will be created in the directory we chose.
We now have two choices for publishing our app, the first being deploy on your android device by dropping it on the SD card and downloading an app installer like appInstaller from the marketplace or deploy to the android community via the Developer Publish site. We are going to publish to market in this tutorial. Navigate to the publisher site, log in and then click on the button that says Upload Application. We now need to find the APK file via the first browse button then enter some information about the application. After filling out the Title, Description, Application type and category, choosing your publishing options and filling out contact information and finally agree to the terms by checking the checkboxes we can finally press Publish. After pressing Publish the application is sent to the market and you can have millions of Android users use your application. In the demo of this application the app I signed was actually sent to market and can be found by clicking search in the Market and entering in Quotes Viewer/Generator. The link provided will only work on an android device, or you could scan the QR code below if you wanted to get there faster.
This series of tutorials has covered the basics of development in an Android Environment to packaging up your applications and getting them ready for market. Now that we have the basics of Android development down we can start on tutorials about more advanced subjects including but not limited to bluetooth control/chat. I hope everyone that has read Android Development 101 has found it useful and looks forward to more. Happy Hacking until the next tutorial!
Many Thankss for all the tutorials. From Spain
bah – “If your___ not looking to shell…”
I have a basic question: once an app is in the Android Market, is there a URL that points to that app? It seems the only way to access an app is through an Android device itself. Great unless you want to link to it from your own site. I’d settle for the QR barcode equivalent.
Odd ya can’t search the search leader’s own marketplace…
Double bah at the “your” typo. There’s certainly a line for being too pedantic, but I don’t think cringing when a writer mixes those up is it.
-Taylor
so.. you can write a decent-ish android app, but you can’t follow the wizard ADT has for exporting a market place ready apk?
oh dear.
I love that you guys have finally got this whole “Article that isn’t a hack” thing down. There were some rocky bits with that top 10 stuff. This is an awesome howto series. Thanks Hackaday!
This is THE best android howto out there.
Dont forget. put your app’s apk on your website and not only in the market. making people have to search for your app on torrent sites because you wanted to be a douchebag and only put it in the market tells non blessed android users that you hate them.
as a android tablet owner, I am forced to torrent all my apps because of lazy developers not putting their apps online anywhere but the market.
@fartface
What if your app isn’t free? There are alternative market places but if you want to get any sort of distribution you would be insane not to upload to the official market place.
You should have a go at getting the vending.apk and see if you can get the official market place running on your device.. but IIRC the only devices that ship without it are ones produced by vendors that haven’t accepted googles policies (i.e. all devices need to allow ADB etc).. do you have one of the tablets from deal extreme by any chance?
@fartface – Under the QR Code is a link to the APK file to extract and place on your SD card :)
Now that you are ready for the market, SURPRISE!
Google hasn’t gotten around to allowing developers
in your country to charge for their applications, unless you are on this exclusive list that hasn’t changed in a year:
http://market.android.com/support/bin/answer.py?hl=en&answer=150324
I have been incredibly disappointed for a very long time now.
Just wondering if you could make this series of tutorials available as a single PDF document (or other single file, downloadable document)?
@CodeMonkey76 – I am working on doing that over the next couple of weeks (formatting etc.) :)
The PDF option would be great. But, could you also go back to tutorials 3-5 and add a link to the next one? For those of us who are doing them in a row, and don’t want to have to search for the next one.
@Howler – The linking is complete and sorry for not having it done sooner :)
@Jerry Whiting You can link to your app using appbrain.com
Why does this app force close when you hit back instead of confirm?
Excellent tutorial, It couldn’t be more clear and helpful for android starters! Cheers from Argentina!
Just a heads up for other users out there. On Windows 7 (and maybe Vista) you will need to enter the CLI as Administrator in order to get the keygen to work. CTRL+SHIFT+ENTER when opening cmd.exe from a Run box will do the trick. This will allow the MyKeygen.keystore file to be created if it doesn’t exist already.
@Greg: how about some /reverse/ links that point to the previous part and/or the first part, so we can start from the beginning without digging through the “Android hacks” category?
fantastic tutorial… very excellent, thanK you very much.. i enjoyed it,,…
Great job, tks. We love the articles. Any other option for droiddraw ?
Great tutorial. Best of all the beginer tutorials out there.
Greg, Awesome job! Your 101 series really get me started nicely on Android development.
Thank you.
Thank Greg, you made a big difference, great job
You will need to run the command prompt as an administrator to create the keystore.