How to use the downloaded maven aar file in my Android project?

Liuyanguo

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 maven file,how can I configure in my project build.gradle,or in my module build.gradle.

I have tried many methods to solve the question,including add

repositories{
    flatDir{
        dirs 'libs'
    }
}
dependencies {
    compile(name: 'myaarfilename.aar', ext: 'arr')
}

in my modulebuild.gradle

and add

buildscript{
    repositories{
        jcenter()
        mavencentral()
        mavenLocal() //to use my local maven aar file
    }
}

in my projectbuild.gradle

all of these methods does not work, so how can I use the my maven cache aar file ,or how can I configure maven?Hoping somebody can help me ,thanks a lot.

Gabriele Mariotti

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'
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to Add and Use an AAR in AndroidStudio Project

How to use Maven in my Java Project and Why?

How to import Android AAR dependencies using Maven in Eclipse?

How to release an AAR with another android library project dependency?

How to import a .aar file into Android Studio 1.1.0 and use it in my code

How to publish an Android .aar file to Artifactory

How to remove .aar file form Android Studio

How to build Flutter project with Android aar file?

iOS Swift How To Use Gif File Inside My Project

How can I generate both an aar and apk of my Android project

How to use a jar file as a library in a maven project

How to use a downloaded font in a django project instead of google fonts api

How can i use a button to open an xml file in my project

Where is my downloaded file

How to include aar files used in library projects in main project in Android

How to use maven project as backend?

How to use an aar including other aar in Xamarin.Android

How to use maven run parameters in the maven project?

How to use .so file of another android project to another project

How to publish in my maven local repository an existing aar with gradle?

How to download excel file using Ajax method- here my file is downloaded in Temp folder not Downloaded in Browser?

How to create *.aar file from "existing" android studio project ( Not creating new android library)?

How to effectively add dependency .aar file in Xamarin project?

How to use Unity exported Android library as an AAR?

How to use a .JAR file class in my project (Eclipse)

How to download leakcanary-android aar file

Downloaded fontawesome-pro-5.7.2 but unable to use it in my React Project

How can I use a downloaded font in a java Project on different PCs?

How to use a module properties file in a Android project