Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 322
Neha Shukla Avatar asked Mar 08 '16 07:03

Neha Shukla


People also ask

How do I view AAR files?

In android studio, open the Project Files view. Find the . aar file and double click, choose "arhcive" from the 'open with' list that pops up. This will open a window in android studio with all the files, including the classes, manifest, etc.

How can add .AAR file in Android Studio?

Add your AAR or JAR as a dependency Navigate to File > Project Structure > Dependencies. In the Declared Dependencies tab, click and select Jar Dependency in the dropdown. In the Add Jar/Aar Dependency dialog, first enter the path to your . aar or .


1 Answers

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.

like image 167
Neha Shukla Avatar answered Oct 29 '22 10:10

Neha Shukla