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!
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.
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 .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With