How To Use The Downloaded Maven Aar File In My Android Project?
My Android project download the maven aar file from others' personal maven,it exists in the directory: C:\Users\username\.gradle\caches\modules-2\files-2.1 now I want to use the m
Solution 1:
My Android project download the maven aar file from others' personal maven,it exists in the directory:
C:\Users\username\.gradle\caches\modules-2\files-2.1
Pay attention because the gradle cache folder is NOT a maven repo.
Then:
buildscript{
repositories{
jcenter()
mavencentral()
mavenLocal() //to use my local maven aar file
}
}
You are using the repositories
block inside the buildscript
and it is NOT related to the dependencies
like an aar file.
If you have an aar file you can put the file in the libs
folder and then use:
dependencies {
compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar')
}
repositories{
flatDir{
dirs 'libs'
}
}
Please pay attention because the aar file doesn't contain the transitive dependencies and doesn't have a pom file which describes the dependencies used by the library.
It means that, if you are importing a aar file using a flatDir
repo you have to specify the dependencies also in your project.
Otherwise if you have a maven repo just use:
dependencies {
compile 'my_dependencies:X.X.X'
}
Solution 2:
Try adding in the project's build.gradle
:
allprojects {
repositories {
maven { url 'file://' + new File('path/to/repository').canonicalPath }
}
}
Post a Comment for "How To Use The Downloaded Maven Aar File In My Android Project?"