The APK Development compiled by ECLIPSE source code uses the system signature mechanism.

Source: Internet
Author: User
I. Android APK Signature
The APK signature must first contain a keystore signature file.
The keystore is generated by the built-in JDK tool keytool.
For more information, see:
Start-> Run-> cmd-> Cd to the JDK directory you installed. My files are C:/program files/Java/jdk1.6.0 _ 10/bin.
Then enter:
Keytool-genkey-alias asaiandroid. keystore-keyalg RSA-validity 20000-keystore asaiandroid. keystore
-Alias follows the alias. Here is asaiandroid. Store.
-Keyalg is the encryption method. Here it is RSA.
-Validity is valid. The value is 20000.
-Keystore is the name of the keystore to be generated. Here is asiandroid. keystore.
Then press ENTER
Press enter and you will be prompted for the entered password: This is used for signature, remember
Then confirm your password.
You will be asked to enter the name, organization unit, organization name, city region, province name, country code (CN), and so on.

Start signing.
Jarsigner.exe also provides a tool in C:/program files/Java/jdk1.6.0 _ 10/bin.
Run the command to sign the APK:
Jarsigner-verbose-keystore asaiandroid. keystore-signedjar lotteryonline_signed.apk lotteryonline.apk asaiandroid. keystore
-Keystore: the name of the keystore.
Lotteryonline_signed.apk: signed APK
Lotteryonline.apk: APK before signature
Press enter to enter the password you just set. Press enter to start signing.

2. Compile the eclipse source code without using make (Android source code directory <D:/myandroid_mx27> ):
1. First, add the Android: shareduserid = "android. uid. System" attribute to the manifest node in androidmanifest. xml.

2、use eclipseto compile the apk(clocksetting.apk) file, but this file cannot be used. Delete the CERT. SF and cert. RSA files under the META-INF directory.

3. Use the platform key of the current Android system (the Android system may be different) to re-sign the APK file (the user meter may not be used for signature ).
First, find the key file. The location in my android source code directory is "build/target/product/security", and the following two files are platform. pk8 and platform. x509.pem.
Then, use the signapk tool provided by Android to sign the signapk. The source code of signapk is under "build/tools/signapk". In this case, you have to prepare for the following compilation:
<1> compile jar
Command line CD to the signapk. Java code directory,
Javac signapk. Java
Obtain signapk $ signatureoutputstream. Class and signapk. Class
Create the directory S/COM/Android/signapk and put the two class files in the directory
Jar cvfm signapk. Jar signapk. mf-c s /.
Note: there is a space in front of "s/" and "."
Generate the signapk. jar file and obtain the signature program signapk. Jar provided by Android.
<2> use the target system's platform Key signature
Copy the platform. pk8 and platform. x509.pem files to the "D:/myandroid_mx27/build/tools/signapk" directory, that is, the directory where signapk. jar and signapk. MF are located.
Java-jar signapk. Jar platform. x509.pem platform. pk8 D:/clocksetting.apk D:/clocksettingsigned.apk
My unsigned (clocksetting.apk.pdf and the signed (clocksettingsigned.apk) APK files are all placed on the d disk, so that the files compiled with the android source code are obtained.
<3> enable and install the VM:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.