久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

本地 aar 庫的傳遞依賴

Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
本文介紹了本地 aar 庫的傳遞依賴的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我們正在制作一些庫,主要是為了我們的 API,我們將使我們的外部開發(fā)人員的生活更輕松.

We're making some library, basicly for our API, that we would make life easier for our external developers.

所以我們創(chuàng)建了新的庫項目,并將 Retrofit 和其他一些庫作為依賴項.

So we created new library project and put Retrofit and some other libraries as dependencies.

dependencies {
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.1'
    compile 'com.squareup.retrofit2:converter-gson:2.0.1'
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
}

現(xiàn)在當我們構(gòu)建它時,它會生成 aar 文件.

Now when we build it, it produces aar file.

但是現(xiàn)在當我們把 aar 文件放到 libs 目錄并設(shè)置為依賴時,我們?nèi)匀恍枰谟脩舻?build.gradle 中放入相同的依賴 文件,這很糟糕.應該是從圖書館拿的吧?

But now when we put the aar file to libs directory and set it as dependency, we still have to put the same dependency in user's build.gradle file, which sucks. It should be taken from the library, right?

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    compile(name: 'ourlibrary', ext: 'aar') {
        transitive = true;
    }
}

如何使 transitive = true 工作?

推薦答案

aar 文件不包含嵌套的(或 transitive) 依賴項 并且沒有描述所使用的依賴項的 pom 文件圖書館.

The aar file doesn't contain the nested (or transitive) dependencies and doesn't have a pom file which describes the dependencies used by the library.

這意味著,如果您使用 flatDir 存儲庫導入 aar 文件,您還必須在項目中指定依賴項.

It means that, if you are importing a aar file using a flatDir repo you have to specify the dependencies also in your project.

在您的情況下,由于上述原因,添加 transitive=true 并不能解決您的問題.

In your case adding transitive=true doesn't resolve your issue for the reason described above.

您應該使用 ma??ven 存儲庫(您必須在私有或公共 maven 存儲庫中發(fā)布庫),您不會遇到同樣的問題.
在這種情況下,gradle 使用 pom 文件下載依賴項,該文件將包含依賴項列表.

You should use a maven repository (you have to publish the library in a private or public maven repo), you will not have the same issue.
In this case, gradle downloads the dependencies using the pom file which will contains the dependencies list.

這篇關(guān)于本地 aar 庫的傳遞依賴的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現(xiàn) IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Why I#39;m Getting Duplicate Class When Running My Android Project(為什么我在運行我的 Android 項目時得到重復的類)
主站蜘蛛池模板: 亚洲国产精品va在线看黑人 | 久久精品福利 | 中文字幕av亚洲精品一部二部 | 免费在线观看毛片 | 91豆花视频 | 国产ts人妖系列高潮 | 97精品超碰一区二区三区 | 青青久久 | 高清视频一区二区三区 | 欧美视频第二页 | 亚洲综合婷婷 | 日韩成人在线视频 | 久久亚洲一区二区 | 欧洲视频一区二区 | 亚洲免费人成在线视频观看 | 精品1区2区 | 欧美一级片久久 | 亚洲成人午夜电影 | 自拍视频国产 | 91精品国产综合久久久久久首页 | 激情五月激情综合网 | 亚洲精品一区久久久久久 | 国产成人福利 | 亚洲网站在线观看 | 久久这里只有精品首页 | 欧美精品一区二区在线观看 | 国产亚洲精品久久久久动 | 国产精品欧美一区二区三区不卡 | 青青草原综合久久大伊人精品 | 国产欧美一区二区三区国产幕精品 | 久久久久久久夜 | 久久久久久国模大尺度人体 | 日韩精品一区二区三区中文字幕 | 成人欧美一区二区三区黑人孕妇 | 国产一区二区三区在线免费观看 | 精品国产一区二区三区免费 | 精品国产乱码久久久久久1区2区 | 国产一区二区三区久久久久久久久 | 一区二区视频在线观看 | 国产一区二区在线免费观看 | 成人av免费在线观看 |