The method of introducing aar package in Android project

1. The method of introducing the aar package into the Android project

When I use the sdk of Gaode map, I choose to import the aar package, and then import it according to the online tutorial. But I kept reporting errors, and I was very confused.

here is the tutorial

1. Add in the outer layer of android{} in build.gradle

repositories {
    flatDir {
        dirs 'libs'
    }
}

2. Add the aar package to the libs folder of the project
3. Add it in dependencies

  implementation(name:'名称', ext:'aar')

However, in fact this method seems to be "outdated", now there is no need to add repositories {flatDir {dirs 'libs'}}

At this time, the way to introduce the aar package is simpler, only two steps are required

1. Copy the aar file to the libs folder;

2. Add in the dependencies of build.gradle 

implementation(fileTree("libs"));

2. Android import jar package

As for how Android imports jar packages

1. First download the required jar package

2. Copy the jar package to the app->libs directory under the project (if the libs directory does not exist, create a new one)

3. Right-click the jar package, select add as library, a pop-up window, click OK to successfully import the jar package

Guess you like

Origin blog.csdn.net/m0_60199181/article/details/122670558