Multi dex files define Lcom/google/gdata/util/common/base/Escaper - android

Multi dex files define Lcom/google/gdata/util/common/base/Escaper
I am stuck with the above error. The error ocured after i have added a dependency to the UserVoice SDK
compile 'com.uservoice:uservoice-android-sdk:+'
since i added this dependency i am unable to run my Android project.
I have read about the jarjar command could probably solve this issue. But since the dependency are .aar librararies i do not know what could be the possible solution
any help is greatly appreciated
List of other depedencies:
compile('com.crashlytics.sdk.android:crashlytics:2.1.0#aar') {
transitive = true;
}
compile('com.twitter.sdk.android:twitter:1.1.0#aar') {
transitive = true;
}
compile 'com.android.support:support-v4:21.0.0'
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.github.manuelpeinado.fadingactionbar:fadingactionbar-abc:3.1.2'
compile 'com.squareup.retrofit:retrofit:1.7.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.jakewharton:butterknife:5.1.2'
compile 'com.squareup.picasso:picasso:2.3.4'
compile 'com.melnykov:floatingactionbutton:1.0.5'
compile 'com.balysv.materialmenu:material-menu-abc:1.+'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.5#aar'
compile 'com.facebook.android:facebook-android-sdk:3.20.0'
compile 'com.joanzapata.android:android-iconify:1.0.8'
compile 'com.squareup:otto:1.3.5'
compile 'com.android.support:recyclerview-v7:21.+'
compile 'com.android.support:cardview-v7:21.+'
Gradle depdencies pastebin: http://pastebin.com/0m6b8Wyi

The problem you are having is caused by the fact that you have two dependencies that include the Escaper class. These are most likely dependencies of your dependencies so it's not obvious which one includes that class. You can be sure that com.uservoice:uservoice-android-sdk:+ includes the class Escaper as that is when your error occurs.
You can fix this problem by excluding the dependency from one of your compile dependencies. Take a look at the Gradle docs and scroll down to where it talks about "Excluding transitive dependencies". One thing to be careful of is the fact that the dependencies might be different versions but contain the same class. You should confirm that both libraries will work with the same version of the Escaper class.

Related

Getting MultiDex error while adding dependency for gcm and onesignal push notification

Problem: When I add the below dependencies in build.gradle, I am getting a multiDex error. I know this happens if I have unnecessary dependency but I am not able to sort it out. I am doing this for one single push notification in my app.
I added following dependencies to my build.gradle file:
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
Before this my app was working fine. All of tthe dependecies in my gradle file are listed below (including the above dependencies)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/android-support-v4.jar')
compile files('libs/Parse-1.3.0.jar')
compile files('libs/signpost-commonshttp4-1.2.1.2.jar')
compile files('libs/signpost-core-1.2.1.2.jar')
compile files('libs/signpost-jetty6-1.2.1.2.jar')
testCompile 'junit:junit:4.12'
compile files('libs/volley.jar')
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
}
Any help on how to fix this?
If your intention is just to add Gcm. you dont need those many dependencies. Especially google play services full version.
compile 'com.google.android.gms:play-services:8.1.0'
Its always good to add smaller dependencies which fits your usecase such as
compile 'com.google.android.gms:play-services-gcm:8.1.0'
If you still are still exceeding 65k limit and need multidex, you must enable in your module gradle file.
multiDexEnabled true
in your module grandle file in defaultConfig.
Along with this, its better enable proguard to keep following attributes as well to make sure you dont bloat up the apk size
minifyEnabled true
shrinkResources true
Note that enabling proguard has its own problems which you will have deal with by carefully reviewing proguard-rules.pro
if you can't solve your application's dependencies.
multi dex application supporting can be solution for that.
http://android-developers.blogspot.kr/2014/12/google-play-services-and-dex-method.html
http://developer.android.com/tools/building/multidex.html

Compiling com.parse:parsefacebookutils leads to com.parse.Parse Class not found exception

I'm currently trying to add Facebooklogin capabilites to my App.
According to the Android Docs, when I add
compile 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
To my Build.gradle it should include the entire com.parse.Parse, com.parse.ParseObject... classes already. So I removed the compile for the normale parse-android and now my dependencies look like that:
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
//compile 'com.parse:parse-android:1.10.3' //Already include in parsefacebookutils
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
//NOTE: I do not actually have anything in my 'libs' folder.
BUT after doing so my Applicationclass (and every other Class) can't find the com.parse.Parse stuff. And the com.parse namespace only contains the 'ParseFacebookUtils' class.
I already tried:
compiling the 'com.parse:parse-android:1.10.3' in the dependencies, which only leads to the expected 'DexError' when deploying.
Removing the #aar at the end, which imported the com.parse namespace correctly, but lead to the Gradle error. I assume because the facebookutils have the parse-android:1.10.3 as dependency in their maven project. (http://mvnrepository.com/artifact/com.parse/parsefacebookutils-v4-android/1.10.3)
Warning:Module 'com.parse:parsefacebookutils-v4-android:1.10.3' depends on one or more Android Libraries but is a jar
sounds like there is a bug in the parsefacebookutils that is loaded. I can't say what it is but work around is that download the latest jar files and use them instead of loading.
Parse-1.11.0
ParseFacebookUtilsV4-1.10.3
those .jar files in library directory and remove the compile rows from build.gradle.
at least I'm getting forward with this.

Can't add both Google Play Services and Appcompat-v7 dependencies

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

Braintree Excluding Library from Gradle

I have used following dependency in my Android Studio gradle.
dependencies {
compile project(':facebookSDK')
compile project(':wheel')
compile project(':viewPagerLibrary')
compile 'com.google.code.gson:gson:2.1'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'io.card:android-sdk:5.0.0'
compile files('libs/acra-4.5.0.jar')
compile files('libs/analytics-3.4.0.jar')
compile files('libs/androidasync-1.3.8.jar')
compile files('libs/crashlytics.jar')
compile files('libs/CWAC-Adapter.jar')
compile files('libs/eventbus-2.2.0.jar')
compile files('libs/fastjson-1.1.6.jar')
compile files('libs/gradle-wrapper.jar')
compile files('libs/ion-1.3.8.jar')
compile files('libs/localytics.jar')
compile files('libs/nineoldandroids.jar')
compile files('libs/parse-1.3.0.jar')
compile files('libs/socialauth-4.4.jar')
compile files('libs/universal-image-loader-1.9.0.jar')
}
Now I need to implement Braintree Gradle dependency
compile 'com.braintreepayments.api:braintree:1.+'
But sometimes it show me some other error sometime its shows me java.exe finished with non-zero exit value 3.
I want to use this braintree dependency for payment options please help me out how can i use it without error with the current dependency.
Thanks a lot for solving my problem in advance.
The Braintree Android library depends on GSON version 2.2.4 or higher.. It looks like you're currently depending on version 2.1.0. Upgrading your dependency to 2.2.+ should satisfy Braintree's and allow installation.
If you do run into further problems, Braintree's support can help, via email at support#braintreepayments.com or phone at 877.434.2894.

Gradle Google Play Services gms module error

I'm trying to build my Android Studio project with gradle. I added a compile rule as follows:
compile 'com.google.android.gms:play-services:6.5.87'
However it gives the following error:
Error:Module version com.google.android.gms:play-services:6.5.87 depends on libraries but is not a library itself
I have tried changing version and excluding support-v4 module, as mentioned here:
Crouton depends on libraries but is not a library itself
But I cannot solve the error.
Any help would be appreciated.
EDIT: Here is my dependency list from my build.gradle file:
dependencies {
// compile project(':library')
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.2'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile('org.apache.httpcomponents:httpmime:4.3.5') {
exclude module: 'org.apache.httpcomponents:httpclient'
}
}

Categories

Resources