Linux using Apktool hack to modify Android apk

Source: Internet
Author: User

I usually use the Linux operating system, some time suddenly want to change an Android game
(1)
Installing the JRE
http://java.com/zh_CN/download/index.jsp
find the right version for you

2. Unzip the file
TAR-ZXVF jrexxxx.tar.gz
move the resulting folder jre1.7.0_45 (my folder name) to/usr/lib/java, if the Linux Mint Debian directory is/usr/lib/jvm/, let's say move to the Java directory
MV Jre1.7.0_45/usr/lib/java with mv Command

3, run the command $sudo vim/etc/environment
Add environment variables and add them directly to the file .
java_home= "/usr/lib/java/jre1.7.0_45"
classpath= "$JAVA _home/lib"
path= "$JAVA _home/bin: $PATH"

if the original is not installed Java, Manual export Path= "/usr/lib/java/jre1.7.0_45: $PATH"
Otherwise, perform the following steps:
set the current default Java interpreter
$sudo update-alternatives--install/usr/bin/java Java/usr/lib/java/jre1.7.0_45/bin/java
Run Command
$sudo update-alternatives--config java
Select the installation version

Test
$ java-version
java Version "1.7.0_45"
Java (TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot (TM) Client VM (build 24.45-b08, mixed mode)
Installation Successful

(2)
http://code.google.com/p/android-apktool/
Download
apktool1.5.2.tar.bz2
apktool-install-linux-r05-ibot.tar.bz2

unzip, take AAPT Apktool Apktool.jar to/usr/local/bin/
How to use Http://code.google.com/p/android-apktool/wiki/FrameworkFiles
http://code.google.com/p/android-apktool/wiki/ApktoolOptions
generally apktool D program. APK is generated after the "programs" folder, modified after the Apktool B program/will be under "program/dist/" to generate a new "program. APK"

(3)
In addition to Apktool, there is an anti-compilation method, you can view the Java source code, the two together more powerful
Dex2jar tool to convert Dex files into jars
http://code.google.com/p/dex2jar/
Download it
Dex2jar Using Tutorials
Http://code.google.com/p/dex2jar/wiki/ModifyApkWithDexTool

Jd-gui
http://jd.benow.ca/
Download jd-gui-0.3.5.linux.i686.tar.gz
Use the Jd-gui to view the Java code in the jar

# Convert Classes.dex in test_apk-debug.apk to Test_apk-debug_dex2jar.jar
d2j-dex2jar.sh-f-o test_apk-debug_dex2jar.jar test_apk-debug.apk
# Validate Jar
d2j-asm-verify.sh Test_apk-debug_dex2jar.jar
# Convert to Jasmin format
d2j-jar2jasmin.sh-f-o test_apk_jasmin test_apk-debug_dex2jar.jar
Uninstall the old apk

Modify the Smail file

Create a new apk file
# Generate Jar
d2j-jasmin2jar.sh-f-o test_apk_jasmin.jar test_apk_jasmin/
# Validate Jar
d2j-asm-verify.sh Test_apk_jasmin.jar
# Convert to Dex
d2j-jar2dex.sh-f-o classes.dex test_apk_jasmin.jar
# Generate a copy
CP test_apk-debug.apk test_apk-debug-toast.apk
# Replace the classes.dex in test_apk-debug-toast.apk
zip-r test_apk-debug-toast.apk Classes.dex
# signature APK
d2j-apk-sign.sh-f-o test_apk-debug-toast-signed.apk test_apk-debug-toast.apk
re-install it.

(4)
Finally, the "program. APK" generated by the recompile is signed, otherwise it cannot be run

Download signapk This web search a lot of things like http://ishare.iask.sina.com.cn/f/25267528.html
English Course: http://www.londatiga.net/it/how-to-sign-apk-zip-files/

ensure that the installation has OpenSSL, generate key
OpenSSL genrsa-out Key.pem 1024x768
OpenSSL req-new-key key.pem-out Request.pem
OpenSSL x509-req-days 9999-in request.pem-signkey key.pem-out Certificate.pem
OpenSSL pkcs8-topk8-outform der-in key.pem-inform pem-out key.pk8-nocrypt

to sign
Java-jar signapk.jar Certificate.pem key.pk8 program. APK signature. apk
finish, handsome dare not go out programmer group: 31843264

Linux using Apktool hack to modify Android apk

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.