Jar package conflict resolution, rename Jar package

Table of contents

1. Download the jarjar third-party tool and create a txt file to execute the command

 2. Open the rule.txt file and write the command:

3. Open the command line, cd to your folder path

4. Jar packages with short package names like QQ need special handling


1. Download the jarjar third-party tool and create a txt file to execute the command

Baidu Netdisk download link [link: pan.baidu.com/s/1cSHblh26...extraction code: 3buv]. After the download is complete, put the jar package and jarjar-1.4.jar that need to be renamed in the same folder (the folder wechat I created). Create a new txt file under this folder, and I name it rule.txt here. I use the solution to the WeChat resource jar package conflict as an example here.

 2. Open the rule.txt file and write the command:

rule com.tencent.mm.opensdk.** com.test.wechatsdk.@1

  • "com.tencent.mm.opensdk" is the package name path to resolve the conflict jar package;
  • "com.test.wechatsdk" is the new jar package name;

3. Open the command line, cd to your folder path

Enter cd on the command line and drag your folder directly to the command line, and its path will appear:

After entering the above command, click Enter, then enter the command to execute the rename, and wait for the new jar package to be generated.

java -jar jarjar-1.4.jar process rule.txt wechat-sdk-android-without-mta-6.8.0.jar wechat-sdk.jar
  • In the command, replace rule.txt with the file you created in the first step;
  • wechat-sdk-android-without-mta-6.8.0.jar is the Jar package you want to rename.
  • wechat-sdk.jar is the Jar package name after you renamed the package name.

Then decompile and look at the jar package, the package name path has been modified, and you're done.

4. Jar packages with short package names like QQ need special handling

        The path of the jar package of QQ is com.tencent.**. If you replace it in this way, all the places containing com.tentcent in the jar package will be replaced, and the function you call QQ will be invalid. Some package names in the following figure are and For QQ intercommunication, replace it with your custom package name and the QQ function will definitely not be adjusted.

         The correct approach should be to change the original command line in the rule.txt file to replace it one by one.

rule com.tencent.connect.** com.test.qqsdk.connect.@1 
rule com.tencent.open.** com.test.qqsdk.open.@1 
rule com.tencent.tauth.** com.test.qqsdk.tauth.@1 
rule com.tencent.a.a.** com.test.qqsdk.a.a.@1 

Guess you like

Origin blog.csdn.net/zhao8856234/article/details/127256554