3

I want to use a library that is API 19+ but my project is API 9+. I get the following error:

    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

What I want to do is have the app available for API 9+ but check the user's Android version before the the Activity of the app where the library is used is loaded and just have that part of the app available to 19+. I would like to use Gradle rather than import the library manually. But since it won't even compile I do not know how I can do this.

I already tried tools:overrideLibrary and it did not work either. It gets stuck at :app:transformClassesWithDexForStandardDebug and then fails.

Here is the Gradle Console output:

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
Questioner
  • 2,451
  • 4
  • 29
  • 50

0 Answers0