Neha Shukla
Neha Shukla

Reputation: 3660

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!

Upvotes: 6

Views: 7751

Answers (1)

Neha Shukla
Neha Shukla

Reputation: 3660

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.

Upvotes: 11

Related Questions