此随笔,记录如何把项目中引入的库,换成本地引入的形式。
Android Studio 其实是方便我们引入第三方库的,只需要在build文件中,引入一下compile‘’  或 implementation‘’就好了
但是由于我公司有外网限制,所以研究了一下,如何把这种网络库获取的方式,换成本地引入
首先你需要知道你引入的库的名字,去 https://mvnrepository.com  这个网站进行查找。然后下载下来。

这时候我们会发现有些库用的不是jar文件,还是aar文件,jar文件我们都会引入,但是aar文件怎么引入呢。

方法如下:

第一步:在app下的build中加入一下代码repositories dependencies 是同一层级的,我是把下面这段代码放在了dependencies 上面

repositories {
    flatDir {
        dirs 'libs'
    }
}

第二步:在dependencies 中这么添加进去就好了。

dependencies {
    compile(name: 'tkrefreshlayout-1.0.7-beta', ext: 'aar')
    compile(name: 'autosize-1.1.2', ext: 'aar')
    compile(name: 'expandable-recyclerview-0.0.3', ext: 'aar')
    compile(name: 'litepal-core-1.6.1', ext: 'aar')
}

 

相关文章:

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