Gradle Google Play Services gms module error - android

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

Related

Firebase duplicate files build error

I have been developing and working on my App, I then decided to build the APK I then got duplicate file error specifically talking about firebase zzc.class? which I could not find. I have seen duplicate file error before and sorted it out but this Firebase error has really slowed down my work because I have seen no specific answer to my issue.
Below are my dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.+'
compile 'com.android.support:support-v4:25.+'
compile 'com.android.support:design:25.+'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui:2.0.1'
compile 'org.apache.pdfbox:pdfbox:2.0.0'
compile 'net.igenius:customcheckbox:1.3'
compile 'com.roger.catloadinglibrary:catloadinglibrary:1.0.1'
testCompile 'junit:junit:4.12'
}
Then the error:
You are using different versions of the same libraries:
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui:2.0.1'
As you can read here there is a dependency between firebaseui and firebase libraries:
FirebaseUI Version Firebase/Play Services Version
2.3.0 11.0.4
2.2.0 11.0.4
2.1.1 11.0.2
2.0.1 11.0.1
Use the same version to avoid these issue.
Also there is no reason to use the old:
compile 'com.firebase:firebase-client-android:x.x.x'
Check the migration guide and use:
compile "com.google.firebase:firebase-database:X.X.X"
Keep in mind that the latest version requires the google maven repo:
allprojects {
// ...
dependencies {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
This is happening because you have a duplicate in your build.gradle file. To solve this, you need to remove the following line of code:
compile 'com.firebase:firebase-client-android:2.3.1'
You cannot mix the old version of dependency with the new one.
Make sure to update firebase version to latest available version in your build(app) configuration exactly mentioned in the firebase documentation.
[https://firebase.google.com/docs/android/setup/]
If you are using play services make sure that the version of firebase library should be exactly same as of play services version.
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
If there is a library conflict then add gradle as:
defaultConfig {
multiDexEnabled true
}
and in your baseapplication
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}

Android Eclipse : How to resolve third party library dependencies corresponding to gradle build

I am porting an android application project built with non-eclipse tool, with gradle in use, perhaps the tool was Android Studio. I have the .zip file of the project. So, far I have put all layout,values and drawables in place. I am stuck at the last step of dependencies.
The project depends on Github : BlueJamesBond library and many others. This is the build.gradle dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile "com.android.support:support-v4:+"
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
}
Now, the BlueJamesBond itself is using gradle and I have no idea how gradle works. I was expecting some jar of the library which I could have added in Build Path. Can anyone please suggest how to resolve the dependency in my project?

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.

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

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.

Categories

Resources