1. Named Modulea in the Android Library example, File, new, new Module
2. Modify the build.gradle that you just created Modulea
Add Publishnondefault True under Android entry (otherwise there will be no compiled jar folders and files under the build folder)
3. If you have other dependent jar files, place them inside the Modulea Lib folder and add the link path under Dependance
Dependencies {Implementation Filetree (include: ['*.jar'], dir:'Libs') Testimplementation'junit:junit:4.12'Implementation'COM.ANDROID.SUPPORT:APPCOMPAT-V7:28.0.0-ALPHA3'androidtestimplementation'com.android.support.test:runner:1.0.2'androidtestimplementation'com.android.support.test.espresso:espresso-core:3.0.2' Implementation files ('libs/xxx-classes.jar' )}
4. Add the following code
task Clearjar (type:delete) {Delete'Build/libs/xyz.jar'////This line means that if you have already made a bag and then pack it, delete the original package .}task Makejar (type:copy) { from('build/intermediates/intermediate-jars/release/')//this line represents the path of the file to be packaged, according to the following content, which is actually the path under the Classes.jarInto'build/libs/')//This line indicates the package's build path after packaging, that is, the resulting package existsInclude'Classes.jar')//See this line, if you know anything about subcontracting, you can see that it's just packing some classes.Rename ('Classes.jar','Xyz.jar')}makejar.dependson (Clearjar, build)
Note: The folder name in the Pink box may vary depending on the as version
5. Locate the Makejar under this folder, double-click, and compile it to find the compiled Xyz.jar in the build/libs/directory under Modulea
6 If you want this file to be used in Unity3d, just throw it into the Unity3d assets/plugins directory
Reference: Https://stackoverflow.com/questions/43039532/no-release-bundle-folder-after-upgrading-android-studio
53406390
Androidstudio 3 Export Jar file