Reprint please indicate the source: juejin.cn/post/684490…

Written in the beginning

There are so many things in March that I did not write a good blog post.

In fact, Amigo study chapter 3 has listed the outline, but I hope to share more detailed, learn more in-depth, and the company’s task is heavy…

Fortunately, I have a little time today, and I’m finishing up my work. Share some of the decompilation tools you’ve encountered in your projects. Decompiler we should be familiar with, just recently on an Android package decompiler – change the name of the application – packaging – signature – release, such a series of operations. So I decided to write it down, mainly for study, summary and memorization.

Decompile resource files

  • Apktool gets the program’s source code, images, XML configuration, language resources, and other files.
  • Dex2jar converts classes.dex to a JAR file.
  • Jd-gui views jar files.

The above tools are searchable and downloadable.

In Windows, press Windows + R and enter CMD. The default path for opening the CLI is drive C. If you decompress the decompression tool, the default path is in drive D. Press Enter to go to the root directory of drive D. Then type “CD D:\download\apktool” to locate the apktool folder.

Copy the apk file to be decompiled to the apktool folder.

Apktool d -f [decompiled APK file] -o [decompiled folder]

For example, apktool d -f ABC. Apk -o ABC

If you only need to change the name of your application or other resource files, you can check out decompiled folder.

If you want to see the app source code, go ahead…

Decompile source code

After downloading it, decompress it to a local disk, and then enter “CD D:\download\dex2jar” to locate the dex2jar folder.

Similar to the previous step.

Unzip abc.apk and copy classes.dex to the dex2jar folder.

Enter dex2jar.bat classes.dex in CMD

After a meal of output… In the dex2jar folder, you can see the classes_dex2jar.jar file using the JD-GUI tool, or in Android Studio.

This gives you access to the android app’s source code, but most apps confuse the code and see variable names, class names, and so on in a-Z letters. But at this point, you can do a lot of things. You can do things with Fiddler, for example; You can see the general engineering structure; You can see the rough implementation of the core code, etc…

repackaged

After changing the application name, repackage it as follows.

Locate the apktool

Enter apktool b ABC

ABC is the decompiled storage folder

The repackaged apK files generated are in ABC \dist.

The signature again

Decompile – change the name of the application – package again, then sign

This is not the apktool tool, but use the JDK \bin tool jarsinger.exe

CD to your JDK \bin and type:

Jarsigner -verbose -keystore [signature file address] -signedjar [apK file address after signing] [APK file address to be signed] [keystore Alias]

For example, jarsigner -verbose -keystore D:\abc.keystore -signedjar D:\abc_signed.apk D:\abc.apk abcAlias

After a meal of crazy output…

There is no expiry date, so it is the default time.

Is written on the back

To learn more about apktool navigate to the Apktool folder and enter apktool in CMD to get help

Finally, attach the download address of apkTool. jar and click open

This is a foreign website, very slow to open. If you can’t download, try a ladder. If the ladder can not download, the tail of the article has a group number, you can directly find me to ~

Recommended reading: Android Hotfix – Various framework principles learning and comparison of Android hotfix – Tinker implementation and tramping pits

Record here, just for learning!

Thank you for reading! Welcome correction!