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

本地 aar 庫的傳遞依賴

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

問題描述

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

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

所以我們創建了新的庫項目,并將 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'
}

現在當我們構建它時,它會生成 aar 文件.

Now when we build it, it produces aar file.

但是現在當我們把 aar 文件放到 libs 目錄并設置為依賴時,我們仍然需要在用戶的 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 存儲庫中發布庫),您不會遇到同樣的問題.
在這種情況下,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.

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

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

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 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 項目時得到重復的類)
主站蜘蛛池模板: 日韩一区二区三区在线播放 | 黄色免费网站 | 国产精品久久久久久99 | 成人午夜在线视频 | 亚洲黄色大片 | 亚洲精品乱码久久久久久动漫 | 国产一级片在线 | 亚洲成人a v | 五月播播| 毛片av在线 | av天天操 | 国产精品日韩欧美 | 国产第一福利 | 久久瑟瑟| 婷婷一区二区三区 | 中文字幕av久久爽一区 | 亚洲精品在线视频观看 | a级片在线免费观看 | 中文字幕av一区二区三区谷原希美 | 国产激情视频在线观看 | 久久av影院 | 国产精品高清在线观看 | 国产三级视频在线播放 | 国产精品999 | 午夜精品免费 | 天天干天天看 | 97精品国产 | 午夜视频福利 | 日韩亚洲欧美在线观看 | 日韩黄色免费视频 | 伊人网综合 | 久久av资源| 亚洲国产欧美在线 | 中文字幕永久免费 | 欧美高清一区二区 | 日本一级大毛片a一 | 日韩精品免费看 | 在线免费观看毛片 | 黄色三级大片 | 国产精品一区二区免费 | 日本三级大片 |