創(chuàng)建module,選擇 android Library
build → Rebuild Project在 module的output中發(fā)現(xiàn)arr文件
刪除module(File→Project Structure找到module點(diǎn)擊左上角減號),發(fā)現(xiàn)還是沒有刪除,點(diǎn)擊module按鍵盤delete依賴刪除
別的項目引用arr
在app級的build.gradle中添加
repositories {
flatDir {
dirs 'libs'
}
}
在添加 compile(name: 'mylibrary-debug', ext: 'aar')(name后面跟依賴名稱)
然后就可以使用arr中的方法,界面,資源文件
如果遇見重復(fù)導(dǎo)包的問題
第一種,比較好理解。比如 app module 與 library module 各自 libs 目錄中嵌入了相同的 Jar 包。這種情況也比較好解決,只需要將
app module 下的重復(fù) jar 包刪除即可。
第二種,稍微復(fù)雜一點(diǎn)。比如對于 Gradle 遠(yuǎn)程依賴的兩個第三方庫,他們內(nèi)部同時依賴相同的另一個輔助第三方庫。這個時候我們就沒辦
法像第一種情況那樣手動刪除本地文件。好在 Gradle 插件提供了相應(yīng)的解決方案,即使用 exclude group 語法,如:
compile 'com.yifeng.example:example-1:1.0'
compile 'com.yifeng.example:example-2:1.0'{
exclude group: 'com.android.support:support-v4:21.0.0'
}
具體參考 http://mp.weixin.qq.com/s?
這個大佬的文章