Android APK decompilation and packaging Signature

Source: Internet
Author: User

APK decompilation and packaging Signature

I. JDK installation and environment Configuration

1. jdk1.6: http://download.java.net/jdk6/

Jdk-6u17-windows-i586.exe

2. Install it by default.

3. Set Environment Variables

XP system: My computer-> properties-> advanced-> Environment Variables

Create a java_home variable with the value c: \ Program Files \ Java \ jdk1.6.0 _ 17

Create a classpath variable with the value c: \ Program Files \ Java \ jdk1.6.0 _ 17 \ Lib \ DT. jar; C: \ Program Files \ Java \ jdk1.6.0 _ 17 \ Lib \ tools. jar ;. (There is. number)

Modify the PATH variable, and add: C: \ Program Files \ Java \ jdk1.6.0 _ 17 \ bin

 

After two values are determined, the environment variable is set to OK.

You can enter javac in cmd to list many Java commands, which means the installation is normal.

Reference: http://bbs.gfan.com/thread-1218428-1-1.html

Configure the Java environment in Windows



Ii. decompile the APK to get the Java source code (this failed)

1. Tool download: requires the dex2jar and JD-GUI tools

Dex2jar: http://laichao.googlecode.com/files/dex2jar-0.0.7-SNAPSHOT.zip

JD-GUI:

Windows JD-GUI: http://laichao.googlecode.com/files/jdgui.zip

Linux JD-GUI: http://laichao.googlecode.com/files/jd-gui-0.3.2.linux.i686.tar.gz

2. steps:

First, find classes.dexin the androidsoftware installation package, rename .zip the .apk file, and decompress it to obtain the classes. dex file, which is compiled by a Java file and then packaged by the DX tool. Now we use the two tools mentioned above to export the Java source file in reverse direction.

Copy classes. Dex to the directory where dex2jar. bat is located. In command line mode, locate the directory where dex2jar. bat is located and run dex2jar. Bat classes. Dex to generate classes. Dex. dex2jar. jar.

 

Run the JD-GUI tool (which is green without installation) open the jar file above and you will see the source code.

Reference: http://www.eoeandroid.com/thread-90027-1-1.html

Decompile APK

Iii. decompile the source code and images, xml configuration, language resources, and other files of the APK Generation Program.

1. Download the tool.

2. decompress the above two packages to a unified directory: packages ).

3. Open the CMD window, enter the directory where apktool. bat is located, and enter:

Apktool d e: \ h200 \ APK_Decompile-Package_Dexopt \ decompile-package \ apks \ ltv2.2.3.apk E: \ h200 \ APK_Decompile-Package_Dexopt \ decompile-package \ apks \ LTV // command line explanation: output Folder of the file to be decompiled by apktool d

If the Output Folder is not written, a directory with the same APK name will be created in the directory where apktool. bat is located, and the APK content will be decompiled here.

Note that if there is an error similar to the following:

Exception in thread "Main" unacceptable character # fffd special characters are n

Ot allowed

In "<reader>", position 28

At org. yaml. snkeyaml. Reader. streamreader. checkprintable (streamreader. Ja

VA: 68)

At org. yaml. nskeyaml. Reader. streamreader. Update (streamreader. Java: 159)

At org. yaml. nskeyaml. Reader. streamreader. Peek (streamreader. Java: 117)

At org. yaml. nskeyaml. Reader. streamreader. Peek (streamreader. Java: 106)

...

This seems to be caused by the Chinese name of the APK. This error is not returned if you name it in English.



Open the output directory to view the various resources required by women.

4. You can modify the source code of these resources and package them into an APK.

5. compile and package APK, input apktool B E: \ h200 \ APK_Decompile-Package_Dexopt \ decompile-package \ apks \ LTV E: \ h200 \ APK_Decompile-Package_Dexopt \ decompile-package \ APK \ ltv_new2.2.3.apk (apktool B APK directory APK output file)

If no output directory or file is specified, an out.apk will be packaged in the distdirectory of the APK directory.

E: \ h200 \ APK_Decompile-Package_Dexopt \ decompile-package \ apks \ LTV \ Dist \ out.apk

 

Reference URL:
Http://www.eoeandroid.com/thread-90027-1-1.html
Http://hi.baidu.com/%C5%F4%C8%A5%C8%CB%C1%F4/blog/item/ee2a5310ad7118c1c3fd78be.html

Apktool, a tool for APK decompilation (Chinese Version of Android)

Iv. Signature

The APK package from the above apktool has no signature, so you need to sign it for use.

For signature tools and methods, see http://www.hiapk.com/bbs/thread-21261-1-1.html

Here I use the signature tool is: APK-sign.rar, decompress and get a sign_pack.bat batch file with a _ data folder.

This tool sets Android: shareduserid to invalid APK signature for androidmanifest. XML, such as Android: shareduserid = "android. uid. System ".

 

1. Change the APK to a suffix ending with a zip file and decompress it.

2. Copy the decompressed folder to the APK-sign directory (same as the sign_pack.bat directory)

3. You can directly drag the decompressed directory of this apk to the sign_pack.bat script, or enter: sign_pack.bat APK decompress directory under the CMD command.

4. Finally, a folder named "android _ www.hiapk.com" is obtained under the APK-sign directory, and the signed package APK program is in this folder.

Reference: http://bbs.hiapk.com/thread-21261-1-1.html

Fun with little green people-starting from the APK icon (personality icon fool tutorial)

Another signature is as follows:

The signing tool we need is auto-sign. It uses the batch processing command to sign the APK file using signapk. jar. You can use NotePad to open sign. BAT and check its calling relationship.

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.