摇篮排除或添加的JAR文件参考硬包括图书馆clas​​ses.jar内摇篮、图书馆、文件、JAR

2023-09-05 02:12:55 作者:去尼玛的爱情

我正在与一个图书馆中,我纳入我的项目的一些麻烦: 在乞讨,这只是我决通过排除冲突的依赖问题 支持-V4 这是常用共享的模块。

现在的问题是,那些 lbsLib释放中的一个似乎已经建有一个简单的的.jar 文件内部开发版本之前的根项目。 通过运行 ./ gradlew应用:依赖我核实,相关性不是在构建图引用

和我发现这个支持-V4 嵌入到 classes.jar 设 在 : app/build/intermedites/exploded-aar/MyQaaAndroid/lbsLib-release/unspecified/classes.jar/因为你可以看到下面的图片:

我不能重建项目的自己,因为它不是一个开源的lib,所以二题:

如果我加入编译com.android.support:support-v4:18.0 + build.gradle A 多DEX文件引发错误在生成时使库引用了两次。

意外的顶级例外:com.android.dex.DexException:多DEX文件定义Landroid /支持/ V4 / APP / BackStackState;         在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)         在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)         在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)         在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)         在com.android.dx.merge.DexMerger.merge(DexMerger.java:189)         在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)         在com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)         在com.android.dx.command.dexer.Main.run(Main.java:246)         在com.android.dx.command.dexer.Main.main(Main.java:215)         在com.android.dx.command.Main.main(Main.java:106)

如果我删除,需要所有库支持-V4 ,它抛出一个缺失的依赖关系的错误在应用程序运行时。

所以,我想知道是否有可能从构建排除这种的.jar 文件或使他人库依赖于 lbsLib释放嵌入式支持-V4 的.jar

 编译(项目(':lbsLib释放')){
    排除模块:支持-V4
}

编译(com.sothree.slidinguppanel:图书馆:2.0.4'){
    排除模块:支持-V4
}

编译(com.google.android.gms:播放服务:87年6月5日){
    排除模块:支持-V4
}
 

在此先感谢您的回答!

解决方案

我所有的答案谢谢! 我找到了解决办法。我刚刚联系了开发商和事实是,他们建立了搞砸了,现在它的确定。

我可以导入它作为一个常规的摇篮依赖!

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

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. By running ./gradlew app:dependencies I verified that the dependency is not referenced in the build graph.

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 :

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

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)

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

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'
}

Thanks in advance for your answers !

解决方案

I Thanks for all your answers ! I found solution. I just contacted the developers and the fact is that their build was messed up, now it's ok.

I can import it as a regular gradle dependency !