How can I use aar dependency in Android Studio?

I have a problem using the aar package in Android Studio Project. Yesterday I wrote an Android Studio library called xEditText

by adding a dependency like this:

compile com.nineoldandroids:library:2.4.0

and then i build this library in aar package. When I use this aar package in my project like this:

compile xEditText-release

and run, I found it crashed, it was a "Class bloat error" error. I later got a response when I add compilation to my project like this:

compile com.nineoldandroids:library:2.4.0

it works well.

But I don't know why I had to compile the dependency com.nineoldandroids:library:2.4.0

compiled in my library for my project again?

+3


source to share


2 answers


But I don't know why I have to compile the dependency (com.nineoldandroids: library: 2.4.0) that was compiled in my library for my project again?

Since it xEditText

is a library, nineoldandroids

it becomes a transitive dependency for any project that uses xEditText

. Transitive dependencies are not output to the output file by default aar

.



You can fix this behavior by specifying what nineoldandroid

should be included xEditText

like so:

compile ('com.nineoldandroids:library:2.4.0') {
    transitive = true
}

      

0


source


You can add aar-Files as modules: File -> New -> New Module -> Import .JAR or .AAR packages.



-1


source







All Articles