Neha Shukla Neha Shukla - 19 days ago 6
Android Question

Not able to access class from .aar file

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!

Answer

Finally I found solution even on Gradle 1.1.0. I found help from [Here][1] 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.

Comments