当前位置:   article > 正文

Android Studio导入添加aar包_repositories { flatdir { dirs 'libs' } }

repositories { flatdir { dirs 'libs' } }

在 app 的build.gradle 中 dependencies 前面 添加 repositories

//作用是添加一个本地仓库,并把libs目录当做仓库地址
repositories {
    flatDir {
        dirs 'libs'
    }
    maven { url "http://maven.aliyun.com/nexus/content/repositories/releases" }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

然后就可以在dependencies 中添加导入 aar 包

dependencies {
//...
implementation(name: 'aar-name', ext: 'aar')
//...
}
  • 1
  • 2
  • 3
  • 4
  • 5

具体例子 如下:

//...
    //ActionDialog
    implementation(name: 'action_dialog_library', ext: 'aar')
//...
  • 1
  • 2
  • 3
  • 4

添加了aar包后,重新编译

注意:如果有多个libs目录,比如在子模块 ttt 中也有libs 用 逗号隔开 如下:

repositories {
    flatDir {
        dirs 'libs', '../ttt/libs'
    }
    maven { url "http://maven.aliyun.com/nexus/content/repositories/releases" }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/927577
推荐阅读
相关标签
  

闽ICP备14008679号