2

How to add AAR library in Android Studio 1.0.2? I search about this and I found a posts, where saying that I need to put library file into libs folder. But it doesn't work. This library is for internal use and never published in open access. File build.gradle contains this line:

compile fileTree(dir: 'libs', include: ['*.aar', '*.jar']) 

But Studio can't find resources from library. I've try to add it manually:

compile(name:'somelib-1.32', ext:'aar') 

And when I get this error:

"Error:Failed to find: :somelib-1.32:" 

How to fix it?

2

1 Answer 1

2

The build System didn't manage very well the -, as for res files.

Replace it by _ or CamelCase, so somelib-1.32.aar become somelib_1.32.aar

EDIT : Also don't forget to add flatDirs[...] to your project build.gradle

allprojects { repositories { jcenter() flatDir { dirs 'libs' } } } 
Sign up to request clarification or add additional context in comments.

4 Comments

I remove -1.32 from library file name, but nothing changed.
@BArtWell se my Edited answer
Actually replacing - with _ made a difference? I am surprised this matters for jar and aar names...
I get below error. Error:Project AreaDUMApp: Only Jar-type local dependencies are supported. Cannot handle: /Users/mango/Android/bsm_areadum/areadum/AreaDUMApp/libs/versioncontrol_android_1.4.4 2.aar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.