With Android Studio 3.X.X, adding local .AAR file to Android project is not working (Build is success but getting runtime exceptions)
I tried below methods (Taken reference From: https://stackoverflow.com/a/23326397/5685911, https://stackoverflow.com/a/24894387/5685911, etc.), but none worked for me:
1. Import the local aar file:
(I) File>New>New Module>Import the .AAR Package [On "Finish" click the .AAR gets included automatically into settings.gradle file as below:
include ':app', ':myAAR'
(II) Add AAR module dependency in app level build.grdle file as below:
implementation project(":myAAR")
2. Using flatDir method:
(I) keep aar file in libs folder
(II) Add flatDir{dirs 'libs'} into the project level build.gradle file as below:
allprojects {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
}
(III) Add AAR dependency in app level build.gradle file as below:
dependencies {
implementation(name:'myAAR', ext: 'aar')
}
Worked around: Need to include all the library imported by the AAR module into the app level gradle. It seems imports from the AAR file are not propagated using any of the above method. BUT, I think it is not the proper solution. Any help would be appreciated here with a big THANKS :)