How to add .aar dependency in library module?

后端 未结 5 729
北海茫月
北海茫月 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:29

    Follow this setting and you will able to add .aar dependency to library module

    build.gradle (Project: ....)

    allprojects {
        repositories {
            jcenter()
            mavenCentral()
            flatDir {
                dirs 'libs'
                dirs project(':library_module').file('libs')
            }
        }
    }
    

    build.gradle (Module: app)

    dependencies {
        ...
        compile project(':library_module')
    }
    

    build.gradle (Module: library_module)

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

    settings.gradle (Project Settings)

    include ':app', ':library_module'
    

提交回复
热议问题