转载请标明出处,维权必究:https://www.cnblogs.com/tangZH/p/9939494.html 

更多查看:http://77blogs.com/?p=496

android中引用的包一般分为两种:

1、jar包

2、aar包

arr包其实带有res的jar包,而普通的jar包是不带资源文件的。那么如何在项目中引用呢?

 

1、将aar包复制到libs目录下

2、在build.gradle文件中添加一个本地仓库,并把libs目录作为仓库的地址。

repositories {flatDir {dirs 'libs'}}
android{
.
.
.
repositories {
        flatDir {
            dirs 'libs'
        }
    }
.
.
.

}

3、在build.gradle文件中dependencies标签中添加下面的依赖。

dependencies {
    api fileTree(dir: 'libs', include: '*.jar')
    implementation (name:’你的aar名字’, ext:’aar’)
}

 

若是整个项目都要用到aar包

则用api (name:’你的aar名字’, ext:’aar’)

相关文章:

  • 2022-01-07
  • 2021-10-14
  • 2021-08-10
  • 2022-12-23
  • 2021-11-16
  • 2021-04-02
  • 2021-10-01
猜你喜欢
  • 2021-08-27
  • 2021-04-18
  • 2021-06-24
  • 2021-06-01
  • 2021-12-20
  • 2021-07-15
  • 2021-09-18
相关资源
相似解决方案