使用比我的项目更高的minSdkVersion依赖项 - tools:overrideLibrary不起作用

时间:2016-04-06 09:04:20

标签: android gradle android-min-sdk

我想使用API​​ 19+的库,但我的项目是API 9+。我收到以下错误:

    uses-sdk:minSdkVersion 9 cannot be smaller than version 19 declared in library [*library*] *path to manifest*\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="*library package*" to force usage

我想要做的是让应用程序可用于API 9+,但在加载使用库的应用程序的活动之前检查用户的Android版本,并且只有应用程序的那部分可用于19+。我想使用Gradle而不是手动导入库。但由于它甚至无法编译,我不知道如何做到这一点。

我已经尝试了工具:overrideLibrary,它也没有用。它停留在:app:transformClassesWithDexForStandardDebug然后失败。

以下是Gradle Console输出:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/apache/http/ConnectionClosedException;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)



 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexForStandardDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_45\bin\java.exe'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

0 个答案:

没有答案