Android Emulator (in Eclipse)
- can take a while to load (minutes)....don't turn off....Eclispe will let you load code changes with currently running emulator
- When the emulator is done loading it may ask you to press Menu to unlock, do so by pressing menu just under the screen. Sometimes it doesn't ask ...and you have to do it to see your app.
Android Projects / Code
- java based
- Output : when compile the result will be an .APK file (located in project / bin directory) which is the actual program binary of your application. However, the .APK file your compiler creates can only be used with the emulator on your desktop PC or Mac. You cannot use the same .APK file to install and run your app on your Android phone......YOU MUST FIRST sign your application...herefore, each and every application needs to be signed with a valid certificate that ensures where the application comes from. Meaning: the developer (you!) signs the application with his/her certificate to make sure it is always traceable where the application comes from. See http://developer.android.com/guide/publishing/app-signing.html for details
- You can use self-signed certificates to sign your applications. No certificate authority is needed.
- However --- When you are ready to publish your application, you must sign it with a suitable private key. You can not publish an application that is signed with the default key generated by the SDK tools.
- You can use standard tools — Keytool and Jarsigner — to generate keys and sign your application .apk files.
How to Create a Keystore:
Create a keystore with your own keys and certificates
First of all you need to create a keystore which stores your certificate. A certificate is always created by the developer himself without any interaction from Google. This actually means that Google does not approve certificates before you can use them for signing your application. (Note: other companies like RIM, Nokia/Symbian, Windows Mobile do such things.)Once you installed a Java SDK you can use the default keytool application to create your own keystore. A Java SDK is installed by default on Mac OS X machines and can also be installated additionally on your Windows PC or Linux machine. If you have Java SDK running on your system just go to any prompt and type in the following:
Windows: START»Command
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000more generally
$ keytool -genkey -v -keystore my-release-key.keystore -alias YOUR_NAME -list grewe
(THEN answer questions and make up password, location,etc)
Windows: Mac: Terminal
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000You will be asked to enter a password for your keystore. Choose it wisely and remember it! You will need it every time you sign an APK file. Follow the instructions and finalize the creation of your keystore.
Place the keys at a location that makes sense
Choosing the right place for your keystore is quite important. Let’s imagine you write more than one application so it would not make that much sense to put this keystore into the project directory of the application you are currently working with. As I am using Mac OS X Leopard and Eclipse I got a project directory like /Users/YOUR_NAME/Documents/workspace/DialANumber. However, as mentioned before a more global approach might make so I copied the keystore to the directory:/Users/YOUR_NAME/Documents/workspace/androidkeys
So we got our keystore prepared for signing now.
How to Generate Certificate from key in Keystore
$ keytool -list -alias YOUR_NAME -keystore my-release-key.keystore
Getting Google Maps API using key will sign appication with:
Go to http://code.google.com/android/maps-api-signup.html with certificate from last step.
Android Eclipse - point to Keys
-
If you are developing in Eclipse/ADT and have set up Keytool as described above, signing in debug mode is enabled by default. When you run or debug your application, ADT signs the .apk with the debug certificate and installs it on the emulator. No specific action on your part is needed, provided ADT has access to Keytool.
-
Note: You cannot release your application to the public when signed with the debug certificate.
-
The Android build tools provide a debug signing mode that makes it easier for you to develop and debug your application, while still meeting the Android system requirement for signing your .apk when it is installed in the emulator or a device. When you use debug mode, the SDK tools invoke Keytool to create a debug keystore and key.
The SDK tools create the debug keystore/key with predetermined names/passwords;
- Keystore name – "debug.keystore"
- Keystore password – "android"
- Key alias – "androiddebugkey"
- Key password – "android"
- CN – "CN=Android Debug,O=Android,C=US"
- If necessary, you can change the location/name of the debug keystore/key or supply a custom debug keystore/key to use. In Eclipse/ADT, you can use Windows > Prefs > Android > Build.
more resources
http://www.linuxtopia.org/online_books/android/devguide/guide/publishing/app-signing.html