Google Play Services Base Being Resolved to Version not in Dependencies - android

While updating the google-play-services libraries used in my React Native Android project, upon building I'm getting this error:
The library com.google.android.gms:play-services-base is being
requested by various other libraries at [[15.0.1,15.0.1]], but
resolves to 10.2.4. Disable the plugin and check your dependencies
tree using ./gradlew :app:dependencies.
But when I run ./gradlew :app:dependencies there is no mention of version 10.2.4 of any library.
Here is the dependencies section of my build.grade:
implementation project(':react-native-cookies')
implementation(project(':react-native-google-places')) {
exclude group: 'com.google.android.gms';
}
implementation(project(':react-native-maps')) {
exclude group: 'com.google.android.gms';
}
implementation(project(':react-native-fbsdk')) {
exclude(group: 'com.facebook.android', module: 'facebook-android-sdk');
exclude group: 'com.android.support';
}
implementation 'com.facebook.android:facebook-android-sdk:4.22.1'
implementation(project(':tipsi-stripe')) {
exclude group: 'com.android.support';
exclude group: 'com.google.android.gms';
exclude group: 'com.google.firebase';
}
implementation(project(':react-native-camera')) {
exclude group: 'com.android.support';
exclude group: 'com.google.android.gms';
}
implementation(project(":react-native-google-signin")){
exclude group: "com.google.android.gms";
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:support-core-utils:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.android.gms:play-services-wallet:15.0.1'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
How can I resolve this issue? Thank you
EDIT: I noticed that my react-native-google-places dependency was behind a version, and after updating it the error message has changed to:
The library com.google.android.gms:play-services-base is being requested
by various other libraries at [[15.0.1,15.0.1]], but resolves to
11.6.2.
Looking at the build.gradle for react-native-google-places reveals that it is indeed including com.google.android.gms:play-services-base:11.6.2, but I would have expected the dependency to be excluded due to the exclude group: in my app's build.gradle (see above).

Related

Duplicate classes found in Gradle: How to define a group and module to exclude?

I have 4 error messages when I build my app; they appeared when I addded a new dependency (de.westnordost:osmapi-notes:1.3). The messages are all similar:
Duplicate class org.xmlpull.v1.XmlPullParser found in modules jetified-kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0) and jetified-xmlpull-1.1.3.1 (xmlpull:xmlpull:1.1.3.1)
Duplicate class org.xmlpull.v1.XmlPullParserException found in modules jetified-kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0) and jetified-xmlpull-1.1.3.1 (xmlpull:xmlpull:1.1.3.1)
Duplicate class org.xmlpull.v1.XmlPullParserFactory found in modules jetified-kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0) and jetified-xmlpull-1.1.3.1 (xmlpull:xmlpull:1.1.3.1)
Duplicate class org.xmlpull.v1.XmlSerializer found in modules jetified-kxml2-2.3.0 (net.sf.kxml:kxml2:2.3.0) and jetified-xmlpull-1.1.3.1 (xmlpull:xmlpull:1.1.3.1)
The dependencies are:
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.navigation:navigation-fragment:2.3.2'
implementation 'androidx.navigation:navigation-ui:2.3.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'org.osmdroid:osmdroid-android:6.1.8'
implementation 'org.osmdroid:osmdroid-wms:6.1.8'
implementation 'org.osmdroid:osmdroid-mapsforge:6.1.8'
implementation 'org.osmdroid:osmdroid-geopackage:6.1.8'
implementation 'org.osmdroid:osmdroid-third-party:6.0.1'
implementation 'com.github.MKergall:osmbonuspack:6.6.0'
implementation 'de.westnordost:osmapi-notes:1.3'
}
I have looked at this thread which goes a long way towards finding a solution but I cannot work out the correct group and module to exclude. I have tried all three of these:
configurations {
/* runtime.exclude group: "org.xmlpull" , module: "xmlpull"*/
/* runtime.exclude group: "net.sf.kxml" , module: "kxml2"*/
runtime.exclude group: "org.xmlpull" , module: "jetified-xmlpull-1.1.3.1"
}
but they all end up with the same set of 4 errors. So, what is the correct syntax / group / module that I need to use?
Usually one would exclude it alike this (which appears to suffice):
implementation ("de.westnordost:osmapi-notes:1.3") {
exclude group: "xmlpull", module: "xmlpull"
}
org.osmdroid:osmdroid-mapsforge:6.1.8 also has these classes, but likely some more code than xmlpull. Since they do not have the same package name, you could eventually (if the exclude wouldn't work) relocate one of them with the Gradle Shadow Plugin and exclude by wildcard org.xmlpull.v1.*.
Try to use this way to exclude
implementation('de.westnordost:osmapi-notes:1.3') {
exclude group: 'net.sf.kxml', module: 'kxml2'
exclude group: 'xmlpull', module: 'xmlpull'
exclude group: 'xpp3', module: 'xpp3'
}

Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.ClassNotFoundException - NOT multidex related

On some android phones only the latest build of our app is crashing with
Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.ClassNotFoundException
It's occurring on a phone running Android 5.1.1.
The problem is NOT multidex-related (all other answers I've googled relate to multidex; we've had multidex enabled in our apps for years).
I'm assuming it's related to us updating to the latest Admob, but I haven't been able to find any related advice online.
We're pulling in the following:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.2.0'
}
dependencies {
// NEW FUSE INTEGRATION
compile('com.upsight.android:mediation-core:2.12.0') {
exclude group: 'com.google.android.gms', module: 'play-services'
//exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.android.support'
exclude group: 'com.upsight.android', module: 'mediation-ad-network-u2'
exclude group: 'com.upsight.android', module: 'mediation-ad-network-m2'
exclude group: 'com.upsight.android', module: 'mediation-ad-network-ac'
exclude group: 'com.upsight.android', module: 'mediation-ad-network-al'
exclude group: 'com.upsight.android', module: 'mediation-ad-network-vungle'
}
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:support-v13:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:multidex:1.0.3'
// compile files('libs/FlurryAnalytics_6.7.0.jar')
implementation 'com.flurry.android:analytics:11.3.0#aar'
// compile 'com.flurry.android:marketing:11.3.0#aar' ' No longer needed for Push'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-ads:17.0.0'
implementation('com.adincube.sdk:AdinCube-Java-1626ebe:2.+#aar') {
transitive = true
}
implementation 'com.google.android.ads.consent:consent-library:1.0.6'
// Fyber
implementation (name:'ia-sdk-core-release-7.3.1', ext:'aar')
implementation (name:'ia-video-kit-release-7.3.1', ext:'aar')
implementation (name:'ia-mraid-kit-release-7.3.1', ext:'aar')
implementation (name:'ia-native-kit-release-7.3.1', ext:'aar')
implementation 'com.google.code.gson:gson:2.7'
implementation ('com.google.android.gms:play-services-base:16.1.0')
//implementation ('com.google.android.gms:play-services-ads-identifier:17.2.0')
}
In this case, updating the Gradle build tools to
com.android.tools.build:gradle:3.1.3
eliminated the problem. Previously they were at 3.0.1
So, one more thing for people to try if they come across this problem!

Dependency resolved to an incompatible version

I need to use dialogFlow sdk along with firestore sdk. In separate projects I can use normally, but when I join them, a dependency failure occurs
I have tried to use several different versions of them but to no avail
android {
/* Code */
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/INDEX.LIST'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-firestore:21.0.0'
//erro aqui
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
//implementation 'com.google.firebase:firebase-inappmessaging-display:19.0.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'ai.api:sdk:2.0.5#aar'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'commons-io:commons-io:2.4'
implementation('ai.api:libai:1.4.8') {
exclude module: 'log4j-core'
}
implementation 'com.google.dagger:dagger:2.22'
kapt 'com.google.dagger:dagger-compiler:2.16'
implementation 'io.github.dreierf:material-intro-screen:0.0.6'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.android.billingclient:billing:2.0.3'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'//rede
implementation 'com.squareup.retrofit2:converter-jackson:2.4.0'
implementation 'com.github.pchmn:MaterialChipsInput:1.0.8'
implementation 'com.github.clans:fab:1.6.4'//floatingActionMenu
implementation 'com.github.ialokim:android-phone-field:0.2.3'
implementation 'com.google.cloud:google-cloud-dialogflow:0.108.0-alpha'
//erro aqui
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.stepstone.apprating:app-rating:2.3.1'
}
apply plugin: 'com.google.gms.google-services'
googleServices { disableVersionCheck = false }
The error that is displayed in the attempt to compile:
Dependency resolved to an incompatible version:
Dependency(fromArtifactVersion=ArtifactVersion(groupId=io.grpc, artifactId=grpc-okhttp, version=1.21.0), toArtifact=Artifact(groupId=io.grpc, artifactId=grpc-core), toArtifactVersionString=[1.21.0])
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[1.21.0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: io.grpc:grpc-okhttp:1.21.0 -> io.grpc:grpc-core#[1.21.0], but grpc-core version was 1.23.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the artifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-firestore#21.0.0
-- Project 'app' depends onto com.google.cloud:google-cloud-dialogflow#0.108.0-alpha
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dependency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your build.gradle file.
I was able to solve by adding this to build.gradle
android {
//
configurations.all {
exclude group:'com.google.api.grpc',module:'proto-google-common-protos'
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'com.google.guava',module: 'guava-jdk5'
}
}
The solution and explanation of the problem comes from here

Gradle Libraries Conflict

I'm having a conflict in libraries and failing to resolve it and the error is always
Multiple dex files define Lorg/apache/http/impl/client/DefaultRequestDirector;
The project compiles and runs if I don't implement the jackson2 and Robospice libraries, however, I need so what to do.
here's my gradle
dependencies {
implementation files('libs/speedchecker-android-sdk-1.3.jar')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.code.gson:gson:2.8.4'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1#aar'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'info.hoang8f:android-segmented:1.0.6'
implementation 'com.google.code.ksoap2-android:ksoap2-android:2.6.0'
testImplementation 'junit:junit:4.12'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
implementation('com.google.http-client:google-http-client-jackson2:1.19.0') {
exclude module: 'commons-io'
exclude module: 'xpp3'
exclude group: 'stax'
}
implementation('com.octo.android.robospice:robospice-google-http-client:1.4.14') {
exclude module: 'commons-io'
exclude group: 'org.apache.commons'
}
}
After trying for several hours, I noticed that the conflict is resulting from the following 3 (the two libraries came with the speed test jar file library when i bought it, so after upgrading the build tools the conflict occurred)
implementation files('libs/speedchecker-android-sdk-1.3.jar')
implementation('com.google.http-client:google-http-client-jackson2:1.19.0') {
exclude module: 'commons-io'
exclude module: 'xpp3'
exclude group: 'stax'
}
implementation('com.octo.android.robospice:robospice-google-http-client:1.4.14') {
exclude module: 'commons-io'
exclude group: 'org.apache.commons'
}
change gradle.property and multidexenable= true;
org.gradle.jvmargs=-Xmx1024m
compile 'com.android.support:multidex:1.0.1'
and also include
multiDexEnabled true
it seems like you're mixing libraries that shouldn't be mixed
looking at your build file these libraries are conflicting:
firebase contains both versions 16.0.1 and 17.1.0 which are conflicting and;
there are dependencies to both firebase and gcm (version 15.0.1 ) which are also conflicting
get rid of those and it should build without issues

mixing version can lead to runtime crashes?

implementation 'com.android.support:appcompat-v7:27.1.1'
All com.android.support libraries must use exact same version specification. Mixing versions can lead to runtime crashes.
Found versions 27.1.1, 27.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:cardview-v7:27.1.0
Please help me to solve this problem...
The issue usually rises when third-party libraries are using an older version of the support library. You can get over it by looking at which lib is using the older version and add this to your build gradle on the app level
implementation "com.android.support:animated-vector-drawable:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
In my case, it was the Facebook SDK so I replace this
implementation 'com.facebook.android:facebook-android-sdk:4.23.0'
with
implementation('com.facebook.android:facebook-android-sdk:4.23.0') {
exclude group: 'com.android.support', module: 'animated-vector-drawable'
exclude group: 'com.android.support', module: 'cardview-v7'
exclude group: 'com.android.support', module: 'customtabs'
}
and all my warnings disappeared
27.1.1 is the latest version of the Android support library. So just replace the version to 27.1.1 for all com.android.support dependencies you're using. No reason not to.
I completed the answers of Mukesh Solanki with:
dependencies{
implementation ('com.facebook.android:facebook-android-sdk:4.36.1'){
// contains com.android.support:v7:27.0.2, included required com.android.support.*:27.1.1 modules
exclude group: 'com.android.support', module: 'animated-vector-drawable'
exclude group: 'com.android.support', module: 'cardview-v7'
exclude group: 'com.android.support', module: 'customtabs'
}
implementation "com.android.support:animated-vector-drawable:27.1.1"
implementation "com.android.support:cardview-v7:27.1.1"
implementation "com.android.support:customtabs:27.1.1"
}
}
And all my problem when away

Categories

Resources