Android Studio library Module reference aar file

Original address: https://blog.csdn.net/qq_20872573/article/details/72818758

 

1. The normal module reference aar file of android studio needs to be configured as follows:

 

[java] view plain copy

  1. repositories {  
  2.     flatDir {  
  3.         dirs 'libs'  
  4.     }  
  5. }     // This is added under the android tag  

[java] view plain copy

  1. dependencies {  
  2.     compile fileTree(include: ['*.jar'], dir: 'libs')  
  3.     compile (name:  'aar 名字' , ext:  'aar' )  
  4. }  

 

2. When a library type module needs to refer to the aar file, the above words should also be added to the build.gradle file of the module where it is located.

But when an A Module references this library's module, it also needs to add the following configuration to A's build.gradle:

[java] view plain copy

  1. repositories {  
  2.     flatDir {  
  3.         dirs  'libs' '../modulename/libs'  
  4.     }  
  5. }  

Otherwise, an error that aar cannot be found will be reported.

 

Reference link: http://blog.csdn.net/qq_35522272/article/details/70214962

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325830209&siteId=291194637