Local aar file reference
Sometimes you need to use a third-party aar library, or the source code of the Project is getting bigger and bigger. The division of labor in the project needs to be referenced or for modular purposes.
Arr is like a static library in C/C ++.
There are many online articles on how to create an aar. I will not repeat it here.
The most common way to use gradle is to upload the aar to mavenCentral or jcenter. To reference a local aar, add the following to the module configuration file build. gradle of the project:
Repositories {flatDir {dirs 'libs' // this way we can find the. aar file in libs folder }}Then add the aar file to the libs directory and add it to build. gradle:
Dependencies {compile (name: 'mylib-debug', ext: 'aar ')}It indicates that the mylib-debug.aar is referenced, and it is interesting that if the class in the test project import or use the mylib-debug.aar, compilation will not report an error, which is great!