How to add .aar dependency in library module?

后端 未结 5 743
北海茫月
北海茫月 2020-12-14 00:54

I am having one .aar file of one library module.
I want to use it as a library or dependency in my other project\'s library module.
How do I do it?

5条回答
  •  不思量自难忘°
    2020-12-14 01:19

    In all modules (library or application) where you need the aar file you have to add in your build.gradle the repository:

    repositories {
        flatDir {
            dirs 'libs'
        }
    }
    

    and add the dependency:

    dependencies {
       compile(name:'nameOfYourAARFileWithoutExtension', ext:'aar')
     }
    

    You can use the top-level file to add the repositories, but you can't add the dependencies in the top-level file.
    Pay attention to the relative path of the libs folder that you are using in the module.

提交回复
热议问题