Mac under Apktool Android anti-compilation

Source: Internet
Author: User

1. Download the required documents
Apktool Toolkit:
Https://code.google.com/p/android-apktool/downloads/list
Need to download a apktool jar package and dependencies (auxiliary tools, respectively Windows,osx,linux version)

2. Installation action
Put Apktool.jar in the auxiliary tools directory, that is, and Apktool, aapt together. Enter the Apktool-install-macosx-r05-ibot directory, in the terminal input SH apktool:
Huangdemacbook-pro:apktool-install-macosx-r05-ibot huangxufeng$ SH apktool
Show Results:
Apktool v1.5.2-a tool for reengineering Android apk files
Copyright Ryszard Wi?niewski <[email protected]>
With Smali v1.4.1, and Baksmali v1.4.1
Updated by @iBotPeaches <[email protected]>
Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)

Usage:apktool [-q|--quiet or-v|--verbose] COMMAND [...]

COMMANDs is:

D[ecode] [OPTS] <file.apk> [<dir>]
Decode <file.apk> to <dir>.

OPTS:

-S,--no-src
Do not decode sources.
-R,--no-res
Do not decode resources.
-D,--debug
Decode in debug mode. Check project page for more info.
-B,--no-debug-info
Baksmali--don ' t write out debug info (. Local,. param,. Line, etc.)
-F,--force
Force Delete Destination directory.
-T <tag>,--frame-tag <tag>
Try to use the framework files tagged by <tag>.
--frame-path <dir>
Use the specified directory for framework files
--keep-broken-res
Use if there is an error and some resources were dropped, e.g.:
"Invalid Config flags detected. Dropping resources ", but you
Want to decode them anyway, even with errors. You'll have the to
Fix them manually before building.

B[uild] [OPTS] [<app_path>] [<out_file>]
Build an APK from already decoded application located in <app_path>.

It'll automatically detect, whether files was changed and perform
Needed steps only.

If you omit <app_path> then current directory would be used.
If you omit <out_file> then <app_path>/dist/<name_of_original.apk>
would be used.

OPTS:

-F,--force-all
Skip changes detection and build all files.
-D,--debug
Build in debug mode. Check project page for more info.
-A,--aapt
Loads AAPT from specified.

If|install-framework <framework.apk> [<tag>]--frame-path [<location>]
Install the framework file to your system.

For additional info, see:http://code.google.com/p/android-apktool/
For Smali/baksmali info, see:http://code.google.com/p/smali/

3.decode command

Put the APK package that needs to be recompiled into the Apktool-install-macosx-r05-ibot folder and enter the Apktool-install-macosx-r05-ibot directory in the terminal.

Enter./apk d you want to decompile the APK name, after the carriage return is completed, in this folder will generate a folder with the same name as the APK, which is both anti-compiled Smali and various resource files.

4.build command

After modifying the anti-compilation file, you need to repackage back to the apk, like Decode, need in the Apktool-install-macosx-r05-ibot directory,

Enter./apk b you want to package the anti-compilation folder of the APK (that is, the folder you just created with Decode, the same name as the APK)

5.APK signature-Create a. keystore file

Build APK is not signed with Android app, only apk containing valid app signature can be installed on Android.

You can use Keytool to generate. keystore files under Mac

Terminal input:

Keytool-genkey-keystore hxf.keystore-keyalg rsa-validity 10000-alias hxf.keystore

Here Hxf.keystore is the generated keystore certificate file name,-alias is the alias.

Next, under the terminal, enter the following information according to the process

Enter KeyStore Password:
Enter the new password again:
What is your first and last name?
[Unknown]: Kyokuhuang
What is the name of your organizational unit?
[Unknown]: Ssdut
What is your organization's name?
[Unknown]: Dlut
What is the name of your city or region?
[Unknown]: Dalian
What is the name of your state/province?
[Unknown]: Liaoning
What is the two-letter country/region code for this unit?
[Unknown]: CN
Cn=huangxufeng, Ou=dlut, O=ssdut, L=dalian, st=liaoning, C=china right?
[No]: Y

At this point, the security certificate is generated.

6. Sign the APK

Use Jarsigner signature app under Mac

Terminal input: Jarsigner-verbose-keystore Hxf.keystore-signedjar The name of the app after the signature. Apk-digestalg Sha1-sigalg md5withrsa the app name before signing. APK HXF . KeyStore.

Note that the last Hxf.keystore is the security certificate alias, which should be consistent with the parameters behind the-alias that created the certificate above.

This way, Jarsigner will sign the app with the certificate Hxf.keystore you generated.

At this point, your app can be installed and running properly on Android.

7.zipalign Alignment, if your app needs to upload Googleplaystore, it must be aligned.

Terminal command: ZIPALIGN-V 4 Enter the file name. apk output file name. apk

Attached: Dalvik bytecode and Smali file related content recommended look at this article, write it All

Http://blog.csdn.net/lpohvbe/article/details/7981386

Mac under Apktool Android anti-compilation

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.