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

本地 aar 庫(kù)的傳遞依賴(lài)

Transitive dependencies for local aar library(本地 aar 庫(kù)的傳遞依賴(lài))
本文介紹了本地 aar 庫(kù)的傳遞依賴(lài)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

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

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

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

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)在當(dāng)我們構(gòu)建它時(shí),它會(huì)生成 aar 文件.

Now when we build it, it produces aar file.

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

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) 依賴(lài)項(xiàng) 并且沒(méi)有描述所使用的依賴(lài)項(xiàng)的 pom 文件圖書(shū)館.

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 存儲(chǔ)庫(kù)導(dǎo)入 aar 文件,您還必須在項(xiàng)目中指定依賴(lài)項(xiàng).

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 并不能解決您的問(wèn)題.

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

您應(yīng)該使用 ma??ven 存儲(chǔ)庫(kù)(您必須在私有或公共 maven 存儲(chǔ)庫(kù)中發(fā)布庫(kù)),您不會(huì)遇到同樣的問(wèn)題.
在這種情況下,gradle 使用 pom 文件下載依賴(lài)項(xiàng),該文件將包含依賴(lài)項(xiàng)列表.

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 庫(kù)的傳遞依賴(lài)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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 中獲取當(dāng)前風(fēng)味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復(fù)“意外元素lt;查詢(xún)gt;在“清單中找到錯(cuò)誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風(fēng)味庫(kù)的多風(fēng)味應(yīng)用)
Android dependency has different version for the compile and runtime(Android 依賴(lài)在編譯和運(yùn)行時(shí)有不同的版本)
Why I#39;m Getting Duplicate Class When Running My Android Project(為什么我在運(yùn)行我的 Android 項(xiàng)目時(shí)得到重復(fù)的類(lèi))
主站蜘蛛池模板: 高清免费在线 | 久久99精品久久久97夜夜嗨 | 国产成人免费视频 | 欧美一级艳情片免费观看 | 国产精品福利在线观看 | 日本中文字幕一区 | 欧美一级免费观看 | 国产操操操 | 久久在线免费 | 91精品久久久久久久久中文字幕 | 91在线视频精品 | 神马久久久久久久久久 | 国产四区 | 午夜一区二区三区 | 国产精品视频久久 | 天天操天天天干 | 亚洲高清一区二区三区 | 国产精品性做久久久久久 | 精品美女视频在线观看免费软件 | 久久国产成人 | 成人a在线观看 | 97精品超碰一区二区三区 | 一片毛片| 天天操天天干天天曰 | 成人精品一区亚洲午夜久久久 | 欧美精品久久 | 奇米影视77 | 亚洲日日夜夜 | 亚洲成人免费在线 | 国产精品三级久久久久久电影 | 午夜精品视频在线观看 | 国产福利观看 | 国产精品99久久久久久宅男 | 在线国产一区二区 | 亚洲一区三区在线观看 | 欧美高清视频一区 | 免费看a | 国产91久久精品一区二区 | 天天干b| 亚洲视频在线播放 | 91综合在线观看 |