This article applies to Android applications in Windows using IntelliJ IDEA development tools. Windows 7 was used in this example but the explanation will work for other recent versions of Windows.
It is quite a task learning how to use mobile application development tools. This page describes how to digitally sign your .apk file which is the Android application package file. In short, your Android program file.
Once you have created an APK file to launch it, simply copy to your device and use the Android file manager to install it. The picture below shows the digital signature keystore file, the unsigned APK file and the signed APK file.
The procedure of signing the APK file is quite straighforward but first you must ensure your Java JDK is properly installed and that the Java tools are accessible on your commandline (Windows command console - what used to be called the DOS window). Most important is that your PATH environmental variable (In Windows 7 find this at: Control Panel -> System->Advanced System Settings ->Environment Variables ) should contain the path to the Java bin folder with an entry such as:
C:\Program Files (x86)\Java\jdk1.6.0_16\bin;
The rest of the story proceeds as follows:
At this point you should have the signed APK file in your target folder. Note that the names you use for the .keystore file and the .apk files will vary.
To run this application in your Android device, copy the signed APK file onto your device (I used the USB data cable) and use the "My Files" Android application to install it as follows:
It is quite a task learning how to use mobile application development tools. This page describes how to digitally sign your .apk file which is the Android application package file. In short, your Android program file.
Once you have created an APK file to launch it, simply copy to your device and use the Android file manager to install it. The picture below shows the digital signature keystore file, the unsigned APK file and the signed APK file.
C:\Program Files (x86)\Java\jdk1.6.0_16\bin;
The rest of the story proceeds as follows:
1.
|
Create key storage folder. In my case it is shown on right
|
"C:\Users\DELL\Documents\A-Courses\Android\IntelliJ IDEA\ca\Keytools\keys"
|
2.
|
Change Directory to the key storage folder (created by yourself)
|
C:\Users\DELL>cd "C:\Users\DELL\Documents\A-Courses\Android\IntelliJ IDEA\ca\Keytools\keys"
|
3.
|
Create key with the following command (note that you can select different keystore names – in red)
|
C:\Users\DELL\Documents\A-Courses\Android\IntelliJ IDEA\ca\Keytools\keys>keytool -genkey -alias maneno.keystore -keyalg RSA -validity 20000 -keystore maneno.keystore
|
4.
|
The dialog that follows asks for several items as follows:
Note that some responses are optional. I have no idea which ones…
Passwords are not displayed when you enter them.
|
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: XXX YYYY
What is the name of your organizational unit?
[Unknown]: VVV BBB
What is the name of your organization?
[Unknown]: UUU
What is the name of your City or Locality?
[Unknown]: Nakuru
What is the name of your State or Province?
[Unknown]: Nakuru
What is the two-letter country code for this unit?
[Unknown]: KE
Is CN= XXX YYYY, OU=Unknown, O=Unknown, L=Nakuru, ST=Nakuru, C=KE correct?
[no]: yes
Enter key password for
(RETURN if same as keystore password):
|
5.
|
Sign the .apk file (called Githeko201202.apk in this example)
|
C:\Users\DELL\Documents\A-Courses\Android\IntelliJ IDEA\ca\Keytools\keys>jarsign er -verbose -keystore maneno.keystore -signedjar Githeko1201_signed.apk Githeko201202.apk maneno.keystore
|
6.
|
Provide the password you supplied in step 4 above.
|
Enter Passphrase for keystore:
adding: META-INF/MANIFEST.MF
adding: META-INF/MANENO_K.SF
adding: META-INF/MANENO_K.RSA
signing: res/layout/main.xml
signing: AndroidManifest.xml
signing: resources.arsc
signing: classes.dex
|
7.
|
End of story
|
At this point you should have the signed APK file in your target folder. Note that the names you use for the .keystore file and the .apk files will vary.
To run this application in your Android device, copy the signed APK file onto your device (I used the USB data cable) and use the "My Files" Android application to install it as follows:
- Browse to the device folder that contains the APK file you just copied.
- Select the APK file.
- My Files will ask: Do you want to install this application?
- Answer "Install"
- My Files responds: Application installed.
- If it responds: "Application not installed" it means it is most likely unsigned.
- End of Story.
Next time we will look at other challenging technical tasks w.r.t. Android and IntelliJ IDEA. IntelliJ IDEA is available both as a free application (Community Edition) and a commercial application. Unlike Eclipse which is really a nightmare for most people trying their hand at Android app development for the first time, IntelliJ IDEA is relatively friendly. I guarantee your app will run before you reach retirement age. I can not offer that guarantee for Eclipse or for Netbeans. Sorry Eclipse gurus - it's the truth.
Note: Since this article was written, Google borrowed IntelliJ code and created Android Studio based on this code base. As of June 2017, Android Studio 3.0 has been released. Android Studio is now the official IDE for Android app development.
Above everything, the Messiah is coming soon. Prepare well
Note: Since this article was written, Google borrowed IntelliJ code and created Android Studio based on this code base. As of June 2017, Android Studio 3.0 has been released. Android Studio is now the official IDE for Android app development.
Above everything, the Messiah is coming soon. Prepare well
Comments
Post a Comment