Android Studio 引入本地arr文件。


此隨筆,記錄如何把項目中引入的庫,換成本地引入的形式。
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')
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM