1

Development environment:

  • OS: Windows 7
  • JDK: 1.8.0_66
  • Android Studio: 1.5, built Nov. 12 2015
  • Gradle: v2.8

build.gradle

enter image description here

libs folder

enter image description here

Project Structure

enter image description here

Exception

UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lorg/apache/http/HttpConnection;

Stuck with this issue for the past two days. Understood that there are multiple definitions of that class in the dependencies, but clueless on the fix. Was unable to get any of the answers on this topic to work.

On Eclipse this project / module runs without any issues. This is my first shot at Gradle on Android Studio. So,:

  • Is there a specific Android-Gradle plugin (or similar) that needs to be installed?
  • Adding dexOptions { preDexLibraries = false } also fails: Error:(11, 0) Gradle DSL method not found: 'dexOptions()' Possible causes: The project 'XXX' may be using a version of Gradle that does not contain the method.
  • Any glaring error in the way things are setup here?
  • ROMANIA_engineer
    • 54,432
    • 29
    • 203
    • 199
    Narayana J
    • 307
    • 5
    • 17
    • Try add: `dexOptions { preDexLibraries = false}` to gradle file of your project – mdtuyen Nov 27 '15 at 07:48
    • Check out [this](http://stackoverflow.com/a/21100040/5038873) answer. – daemmie Nov 27 '15 at 08:09
    • @mdtuyen, thanks for the response. Already tried that, Gradle comes back with `Error:(11, 0) Gradle DSL method not found: 'dexOptions()' Possible causes: The project 'XXX' may be using a version of Gradle that does not contain the method.` – Narayana J Nov 27 '15 at 08:15
    • what is in your libs folder ? – mdtuyen Nov 27 '15 at 08:24
    • @mdtuyen, Have already posted the image of the libs folder in the question, please review. Unable to post that image in this comment. – Narayana J Nov 27 '15 at 08:47
    • Check out whcih of your libs reference to HttpConnection. Either check your build folder or use the gradle command of my link. Then delete a lib of exclude this in your gradle file. – daemmie Nov 27 '15 at 08:49
    • @oberflansch, Thanks. * Had already tried the `-q dependencies` command line earlier, `HttpConnection` does not figure anywhere in the dependencies trees. * Looked in the root `build` folder: the `dependency-cache\debug` folder is empty – Narayana J Nov 27 '15 at 08:58

    0 Answers0