2

I am trying to clean up and update the libraries on a project. As part of this I moved from using the classic library folder dependency to one through gradle, for Google Play Services. I started getting an dexDebug error when compiling debug (see Android Studio - UNEXPECTED TOP-LEVEL EXCEPTION: ). From what I understand this error shows up if you have a double dependency somehow.

Below is the dependencies part of my gradle file. If I comment out appcompat-v7 completely, everything works fine. Does play-services already depend on appcompatv7 and automatically bringing it in or what's going on?

dependencies {
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3'

//compile files('libs/commons-codec-1.8-sources.jar')
compile files('libs/engine.io-client-0.2.3.jar')
compile files('libs/ffmpeg.jar')
compile files('libs/Java-WebSocket-1.3.0.jar')
compile files('libs/socket.io-client-0.1.3.jar')
//compile files('libs/javacpp.jar')
compile files('libs/javacv.jar')
compile files('libs/json-simple-1.1.1.jar')
compile files('libs/opencv.jar')
//compile files('libs/twitter4j-async-4.0.2.jar')
compile files('libs/twitter4j-core-4.0.2.jar')
//compile files('libs/twitter4j-media-support-4.0.2.jar')
//compile files('libs/twitter4j-stream-4.0.2.jar')

}

Community
  • 1
  • 1
Flyview
  • 1,899
  • 1
  • 28
  • 46

1 Answers1

3

It turns out there was an exact duplicate to this question:

After update of AS to 1.0, getting "method ID not in [0, 0xffff]: 65536" error in project

I fixed it by adding (this alone will fix the original problem):

defaultConfig {
    ...
    multiDexEnabled true
}

and by cutting down on the massive Google Play Services, and using only subsets of it (this alone will also fix the original problem):

dependencies {
//compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.google.android.gms:play-services-maps:7.0.0'
compile 'com.google.android.gms:play-services-location:7.0.0'
compile 'com.google.android.gms:play-services-gcm:7.0.0'
compile 'com.google.android.gms:play-services-plus:7.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3+'

compile files('libs/engine.io-client-0.2.3.jar')
compile files('libs/ffmpeg.jar')
compile files('libs/Java-WebSocket-1.3.0.jar')
compile files('libs/socket.io-client-0.1.3.jar')
compile files('libs/javacv.jar')
compile files('libs/json-simple-1.1.1.jar')
compile files('libs/opencv.jar')
compile files('libs/twitter4j-core-4.0.2.jar')

}

Community
  • 1
  • 1
Flyview
  • 1,899
  • 1
  • 28
  • 46
  • Slow down. You do not want multidex. Covert from libs to Gradle depdenencies(the whole point of Gradle and Maven). – Jared Burrows Apr 02 '15 at 17:19
  • Well I did do that for the big ones, Google Play Services and appcompat-v7 and then I ran into the issue. I'm updating my answer with what else I did (cut down on Google Play Services) – Flyview Apr 02 '15 at 19:10