In this tutorial we are going to cover packaging one of our applications into an .apk file and getting it ready for the Android Market. *After we have completed this tutorial you should be able to use the tools provided in the AndroidSDK to sign your application, put the application on your phone and install it or send it to the Android Market. *These will be great assets to have if you decide to develop applications that you may want to charge for. *This tutorial will also be a change from the normal ones because it will include little, if any, code.
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.</p>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
and add in
so that the line should look like
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
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.
http://hackadaycom.files.wordpress.com/2010/08/manifest.png
Now that we have the command entered we can step through and determine what each of these variables is doing for the keytool.
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.
http://hackadaycom.files.wordpress.com/2010/08/devsite4.png
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!
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.</p>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
and add in
so that the line should look like
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
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.
http://hackadaycom.files.wordpress.com/2010/08/manifest.png

We now need a private key that will allow us to sign applications by using this key in the signing process. It will have to be your, it will show its either for your work or personal development depending on how its created and have a period of time before it expires. *To make a private key we are going to use the keytool found in our C:/Program Files/Java/jre6 folder. *Once inside the jre6 folder, hold shift and right click on the bin folder and choose the option that says Open command window here. *Once in the command promp we are going to run keytool with a bunch of commands that will assist us in making a private key. The command to be entered into the command window will be as follows:
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.
http://hackadaycom.files.wordpress.com/2010/08/devsite4.png
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!
