1. Use aapt to generate the R. Java class file:
Example:
C: \ snake> aapt
P-F-m-J Gen-s res-I Android. jar-M androidmanifest. xml
Where
-F-m-j f: \ Explorer \ androidbyread \ Gen indicates generating the R with package path under the gen directory in overwrite mode. java,-s res specifies the resource file,-I android. jar specifies the android class package used,-M androidmanifest. configuration file of the specified program in XML
2. Use android
Sdk‑based aidl.exe converts. aidl into A. Java file (if there is no aidl interface file, it can be omitted ):
3. Step 3
Compile a. Java class file to generate a class file:
C: \ snake> javac-classpath Android. jar-D bin SRC \ com \ example \ Android \ snake \ *. Java Gen \ com \ example \ Android \ snake \ r. Java
-Classpath Android. Jar specifies the android class package used,-D bin specifies the location of the generated class file, and the following two are both source files.
4. Use android
The DX. Bat command line script provided by the SDK generates the classes. Dex file:
C: \ snake> DX -- Dex -- output = C: \ snake \ bin \ Classes. Dex c: \ snake \ bin
The first parameter is the generated target file, and the second parameter is the directory where the class file is located (the absolute path must be used)
5. Generate the application APK file:
C: \ snake> aapt p-f snke.apk-v-u-z-M androidmanifest. XML-s res-A Assets-I Android. Jar
The usage is the same as step 1.
6. compress the classes. Dex file generated earlier to the APK file to generate a runable APK application.
C: \ snake> aapt add snail ke.apk bin \ Classes. Dex
7. 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.