Android studio uses gradle to make jar packages and explain the methods of confusion

This article mainly introduces how Android studio uses gradle to make jar packages and confuse them. Let's take a look at the detailed introduction.

First, the configuration of the jar package is very simple. To use the task of jar, you can refer to the official gradle document. The specific code is as follows:

However, it was found that the code in the jar package typed above was not confused, so it was confused. When using the confused proguard.gradle.proguardtask task, it is found that the following error is always reported:

According to the above prompt, outjars is written after injars. It will be empty is a prompt. What's the problem? I thought there was a problem with the configuration in the proguard-rules.pro file, but I emptied the file or reported the above error. The reason for the error is unknown. It took a long time to solve this problem. Suddenly I saw the assemblyrelease task above and remembered that this task would be used when I used APK, and the APK would be confused automatically.

Then the assemblyrelease task will depend on the task dealing with confusion, so check the output log:

Good guy, I found it. You can see from the task: SDK: transformclassesandresourceswithproguardforrelease. The following logs are about Proguard obfuscation tools. Finally, you can see:

The main.jar is the confused jar package, but the jar also contains the information of R class and buildconfig class, so you can filter this information. But the problem also comes. The jar packages have been typed. How to configure them? The solution is to use the jar package as input. The final configuration is as follows:

summary

OK, the task is done. The above is the whole content of this article. I hope the content of this article can bring some help to Android developers. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>