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

Gradle 排除或添加硬包含在庫 classes.jar 中的 JAR 文

Gradle Exclude or add reference for JAR file hard included inside library classes.jar(Gradle 排除或添加硬包含在庫 classes.jar 中的 JAR 文件的引用)
本文介紹了Gradle 排除或添加硬包含在庫 classes.jar 中的 JAR 文件的引用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在項目中包含的庫遇到了一些問題:一開始,這只是一個相互沖突的依賴問題,我通過排除來解決support-v4 是常用的共享模塊.

I'm running into some trouble with a library I included into my project: At the beginning it was just a conflicting dependencies issue that I resolved by excluding support-v4 which is the commonly shared module.

問題在于,其中一個 lbsLib-release 似乎是在開發(fā)人員構(gòu)建之前使用根項目內(nèi)的普通 .jar 文件構(gòu)建的.

The problem is that one of those lbsLib-release seems to have been built with a plain .jar file inside of the root project before the developer build.

通過運行 ./gradlew app:dependencies 我驗證了構(gòu)建圖中沒有引用依賴項.

By running ./gradlew app:dependencies I verified that the dependency is not referenced in the build graph.

我發(fā)現(xiàn)這個 support-v4 嵌入到 classes.jar 中在:app/build/intermedites/exploded-aar/MyQaaAndroid/lbsLib-release/unspecified/classes.jar/,如下圖所示:

And I found this support-v4 embedded into the classes.jar located at : app/build/intermedites/exploded-aar/MyQaaAndroid/lbsLib-release/unspecified/classes.jar/ as you can see on the picture below:

我不能自己重建項目,因為它不是一個開源的lib,所以有兩個問題:

I can't rebuild the project myself because it is not an open-sourced lib, so there is two problem:

  1. 如果我將 compile 'com.android.support:support-v4:18.0.+' 添加到 build.gradle 一個 multiple dex文件 在構(gòu)建時拋出錯誤,因此庫被引用了兩次.

  1. If I add compile 'com.android.support:support-v4:18.0.+' to the build.gradle a multiple dex file error is thrown at build time so the library is referenced twice.

UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/app/BackStackState;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)

`

如果我刪除所有需要 support-v4 的庫,它會在應(yīng)用程序運行時引發(fā)缺少依賴項錯誤.

If I remove all libs which require support-v4 it throws a missing dependencies error at the application runtime.

所以我想知道是否可以從構(gòu)建中排除這個 .jar 文件或使其他庫依賴于 lbsLib-release 嵌入 support-v4 .jar.

So I would like to know if it is possible to exclude this .jar file from the build or to make the others libs depends on the lbsLib-release embedded support-v4 .jar.

compile (project(':lbsLib-release')) {
    exclude module: 'support-v4'
}

compile ('com.sothree.slidinguppanel:library:2.0.4'){
    exclude module: 'support-v4'
}

compile('com.google.android.gms:play-services:6.5.87') {
    exclude module: 'support-v4'
}

推薦答案

嘗試使用 resolutionStrategy (API 參考) 在根 build.gradle.

Try to use resolutionStrategy (API reference) at root build.gradle.

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
    configurations.all((Closure) {
        resolutionStrategy {
            force 'com.android.support:support-v4:21.0.2' // your version of support library
        }
    })

}

這篇關(guān)于Gradle 排除或添加硬包含在庫 classes.jar 中的 JAR 文件的引用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 中多風味庫的多風味應(yīng)用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 免费看啪啪网站 | www.午夜 | 99久久国产 | 天堂精品 | 久操国产 | 亚洲一区二区在线视频 | 第一区在线观看免费国语入口 | 懂色tv | 中文字幕在线一区二区三区 | 亚洲一级淫片 | 欧美成人性生活 | 欧美区在线 | 久久国产综合 | 欧洲成人午夜免费大片 | 亚洲二区视频 | 亚洲第一av| av中文字幕网站 | 天天干天天操天天射 | 搞av.com| 黄网站涩免费蜜桃网站 | 日本人和亚洲人zjzjhd | 操到爽 | h片免费在线观看 | 国产精品福利网 | 欧美成人精品二区三区99精品 | 中文字幕欧美日韩 | 一区二区三区四区视频 | 日韩不卡一二区 | 亚洲乱码一区二区三区在线观看 | 99国产在线| 啪啪毛片 | 一二三区av | 国产精品久久网 | 精品亚洲一区二区 | 免费毛片网 | 欧美日韩国产一区二区三区 | 麻豆va| 久久亚洲欧美日韩精品专区 | 日本不卡一区 | 日韩欧美福利视频 | 91久久精品国产 |