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
Related
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'
}
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!
I get error "Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 16.0.5."
Build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'org.jacoco:org.jacoco.core:0.8.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url = 'https://oss.sonatype.org/content/groups/public' }
maven {
url "https://maven.google.com"
}
}
}
configurations.all {
transitive = true
}
Build.gradle
dependencies {
implementation fileTree(include: '*.jar', dir: 'libs')
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:customtabs:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:exifinterface:27.1.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.5'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation('com.google.code.gson:gson:2.6.2') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation('com.google.http-client:google-http-client:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.oauth-client:google-oauth-client:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'commons-io:commons-io:2.5'
implementation 'net.sf.kxml:kxml2:2.3.0'
implementation 'net.sf.opencsv:opencsv:2.3'
implementation('org.opendatakit:opendatakit-javarosa:2.9.0') {
exclude module: 'joda-time'
}
implementation 'org.osmdroid:osmdroid-android:5.6.4'
implementation 'org.slf4j:slf4j-android:1.6.1-RC1'
implementation 'pub.devrel:easypermissions:0.2.1'
implementation('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev64-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-sheets:v4-rev463-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation 'com.jakewharton.timber:timber:4.6.0'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
implementation 'net.danlew:android.joda:2.9.9'
// Real LeakCanary for debug builds only: notifications, analysis, etc
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
// No-Op version of LeakCanary for release builds: no notifications, no analysis, nothing
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
androidTestImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
odkCollectReleaseImplementation group: 'com.squareup.leakcanary', name: 'leakcanary-android-no-op', version: '1.5.4'
// Android Architecture Components:
implementation 'android.arch.lifecycle:extensions:1.1.0'
// Dagger:
implementation 'com.google.dagger:dagger-android:2.11'
implementation 'com.google.dagger:dagger-android-support:2.11'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
// RxJava 2:
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation 'io.reactivex.rxjava2:rxjava:2.1.10'
// Better "Subjects" for Rx:
implementation 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
// Android bindings for Rx:
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
// RxLifecycle (binds subscription cleanup to component lifecycle):
implementation 'com.trello.rxlifecycle2:rxlifecycle:2.2.1'
implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.2.1'
implementation 'com.trello.rxlifecycle2:rxlifecycle-android-lifecycle:2.2.1'
// Makes binding to Views easy:
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// Used to generate documentation screenshots.
androidTestCompile 'tools.fastlane:screengrab:1.1.0'
// Testing-only dependencies
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.8.47'
testImplementation 'org.robolectric:robolectric:3.5.1'
testImplementation 'org.robolectric:shadows-multidex:3.5.1'
// power mock (for mocking final methods which is not handled by mockito)
testImplementation 'org.powermock:powermock-module-junit4:1.6.4'
testImplementation 'org.powermock:powermock-api-mockito2:1.7.3'
androidTestImplementation 'org.mockito:mockito-android:2.11.0'
androidTestImplementation('com.android.support.test:runner:1.0.1') {
exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
androidTestImplementation('com.android.support.test.espresso:espresso-intents:3.0.1') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.9.0'
}
I saw errors downloading FireBase libraries as well while gradle performs synchronization. I'm upgrading an old app in order to use geofencing API.
Many thanks.
Update the classpath 'com.google.gms:google-services:4.1.0' in project build.gradle.
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).
I'm getting this error when performing a gradle build for a release version.
Error: xpp3 defines classes that conflict with classes now provided by
Android. Solutions include finding newer versions or alternative
libraries that don't have the same problem (for example, for
httpclient use HttpUrlConnection or okhttp instead), or repackaging
the library using something like jarjar. [DuplicatePlatformClasses]
I tried to exclude httpclient but that didn't help.
In the debug version its working but in the release version it gives me this error.
I was using Android Asynchronous Http Client but removing it also didn't resolve the error.
My gradle looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.corona.corona"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.pkmmte.view:circularimageview:1.1'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'org.igniterealtime.smack:smack-android:4.1.0'
implementation 'org.igniterealtime.smack:smack-tcp:4.1.0'
implementation 'org.igniterealtime.smack:smack-android-extensions:4.1.0'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.6.0'
implementation 'io.github.rockerhieu:emojicon:1.4.2'
implementation 'io.github.rockerhieu:emojiconize:1.0.0'
implementation 'com.google.android:flexbox:0.3.1'
implementation 'com.mani:ThinDownloadManager:1.4.0'
implementation 'jp.wasabeef:blurry:2.1.1'
implementation 'com.facebook.shimmer:shimmer:0.1.0#aar'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
}
repositories {
mavenCentral()
}
configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
exclude group: 'org.apache.httpcomponents'
}
}
It seems problem comes from Smack library. Try excluding xpp3 module.
configurations {
all {
...
exclude group: 'xpp3', module: 'xpp3'
}
}
You need to exclude xpp3 from the smack library with:
implementation ('org.igniterealtime.smack:smack-android:4.1.0') {
exclude group: 'xpp3', module: 'xpp3'
}
implementation ('org.igniterealtime.smack:smack-tcp:4.1.0') {
exclude group: 'xpp3', module: 'xpp3'
}
implementation ('org.igniterealtime.smack:smack-android-extensions:4.1.0') {
exclude group: 'xpp3', module: 'xpp3'
}
or, like #jose-antelo answer, you can use the following code to remove xpp3 from all of your dependencies:
configurations {
all*.exclude group: 'xpp3', module: 'xpp3'
}