Because the projects are different, some public libraries are also in C++, and some with resources. If you simply copy the library, it will be another round of configuration. Compiling it into aar will solve these problems.
However, the default Android studio's make model only generates debug packages, and the release apk is generated in time at 3.0 or above, and the release aar will not be generated.
At this time, you need to use the "gradlew assembleRelease" command, open the terminal in Android studio, and execute it in the root directory of the project (cannot be executed in Moudle).
If the Unsupported version 52.0 problem occurs, it means that the version of your terminal is wrong, at least 8.0 or above. Then why can Android studio be generated normally? It cannot be done when it comes to the command line, because Android studio has a built-in Java version.
How to solve this problem? Many people choose to upgrade the Java version, but there are easier methods. If some people's Java still needs a low version to test and support low version of Java programs, is it still upgraded?
Because it is compiled using gradle, open the batch file of gradle to see what other solutions are available.
Generally speaking, under C:\Program Files\Android\Android Studio\gradle\gradle-4.1\bin, the version numbers of different versions are different. The actual directory can be checked in the settings of Android studio.
In the batch file, we see important statements:
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/
Taking the variable JAVA_HOME is easy to do. You just need to execute set JAVA_HOME=C:\Program Files\Android\Android Studio\jre on the command line. This kind of command is only valid for the current command session, and will not change the global Java version. After executing, execute gradlew assembleRelease.
Where is the built-in Java version path of Android studio? Check it out in the settings of Android studio.
Summarize
The above is the method of packaging aar for Android studio introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!