Exporting AAR
First the Gradle script for the Android Library project only needs to be declared at the beginning
apply plugin: ‘com.android.library‘
After that, and the same method as the export apk file, execute ./gradlew assemblerelease, then you can generate an AAR file in the Build/outputs/aar folder
Referencing a local AAR
1: Make sure that your AAR file does not have a duplicate res for the existing project, including the image name, such as Ic-launcher, String, Dimen, and so on, once the main project references the duplicate resource name, an error will be made.
2:in Build.gradle
Apply plugin: ' Com.android.application 'Android {compilesdkversion22buildtoolsversion"22.0.1"Defaultconfig {ApplicationID"Xxxxxxxxxxx"minsdkversion22targetsdkversion22Versioncode1Versionname"1.0"} buildtypes {release {minifyenabledfalseproguardfiles Getdefaultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro '}}} repositories {flatdir {dirs ' Libs ' }}dependencies { Compile (name:' app-release ', ext: ' AAR ')}
[Android Studio] using local AAR files