6

I want to access methods of a class which reside inside a .aar file. I am following @PoliceEstebi's answer from how to import .aar file.

But still I am not able to access class methods from the .aar file.

If anyone can help that would be great!

Community
  • 1
  • 1
Neha Shukla
  • 3,572
  • 5
  • 38
  • 69
  • 1
    http://stackoverflow.com/questions/16682847/how-to-manually-include-external-aar-package-using-new-gradle-android-build-syst – IntelliJ Amiya Mar 08 '16 at 07:54
  • If you are using Gradle 3.0.0 or higher, this simple Gradle setup worked for me: https://stackoverflow.com/questions/29081429/android-studio-cannot-resolve-symbols-from-imported-aar-module/50139545#50139545 – user1506104 May 03 '18 at 04:14

1 Answers1

11

Finally I found solution even on Gradle 1.1.0. I found help from Here by @AliDK answer.

create a folder in app by name aar.

make a copy from myLibrary.aar and put in app/aar. then

buildscript {
repositories {
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:1.1.0'
  }
}

allprojects {
repositories {
    jcenter()
    flatDir {
        dirs 'aar'
    }
  }
}

and write below code in MyProject/app > build.gradle

dependencies {
...
compile(name: 'myLibrary', ext: 'aar')
}

And it worked for me after spending 2 days.

Thanks to @AliDK..

I hope it would work for others too.

Community
  • 1
  • 1
Neha Shukla
  • 3,572
  • 5
  • 38
  • 69