Android parse-SDK-android and facebook SDK incompatibility - android

Latest versions of android parse SDK (1.24.x) include bolts-tasks instead of referencing it. In an app which also use Facebook SDK this leads to duplicate classes :
java.lang.RuntimeException: Duplicate class bolts.AggregateException found in modules bolts-tasks-1.24.1.jar (com.github.parse-community.Parse-SDK-Android:bolts-tasks:1.24.1) and bolts-tasks-1.4.0.jar (com.parse.bolts:bolts-tasks:1.4.0)
Duplicate class bolts.AndroidExecutors found in modules bolts-tasks-1.24.1.jar (com.github.parse-community.Parse-SDK-Android:bolts-tasks:1.24.1) and bolts-tasks-1.4.0.jar (com.parse.bolts:bolts-tasks:1.4.0)
Duplicate class bolts.AndroidExecutors$1 found in modules bolts-tasks-1.24.1.jar (com.github.parse-community.Parse-SDK-Android:bolts-tasks:1.24.1) and bolts-tasks-1.4.0.jar (com.parse.bolts:bolts-tasks:1.4.0)
Duplicate class bolts.AndroidExecutors$UIThreadExecutor found in modules bolts-tasks-1.24.1.jar (com.github.parse-community.Parse-SDK-Android:bolts-tasks:1.24.1) and bolts-tasks-1.4.0.jar (com.parse.bolts:bolts-tasks:1.4.0)
Duplicate class bolts.BoltsExecutors found in modules bolts-tasks-1.24.1.jar (com.github.parse-community.Parse-SDK-Android:bolts-tasks:1.24.1) and bolts-tasks-1.4.0.jar (com.parse.bolts:bolts-tasks:1.4.0)
Duplicate class bolts.BoltsExecutors$1 found in modules bolts-tasks-1.24.1.jar (com.github.parse-community.Parse-SDK-Android:bolts-tasks:1.24.1) and bolts-tasks-1.4.0.jar (com.parse.bolts:bolts-tasks:1.4.0)
...
Is there a solution ?

try this
implementation ("com.github.parse-community.Parse-SDK-Android:parse:1.24.1"){
exclude module:'bolts-tasks'
}
If it doesn't work then try this
implementation ("com.github.parse-community.Parse-SDK-Android:parse:1.24.1"){
exclude group:'com.github.parse-community' ,module:'bolts-tasks'
}

if you are using com.facebook.fresco:fresco then following solution is working
implementation ('com.facebook.fresco:fresco:2.1.0'){
exclude module:'bolts-tasks'
}
implementation "com.github.parse-community.Parse-SDK-Android:parse:1.24.1"

try this works for me
implementation "com.github.parse-community.Parse-SDK-Android:parse:1.24.1"
implementation ('com.github.parse-community:ParseFacebookUtils-Android:1.14.0'){
exclude module: 'bolts-android'
}

Related

Gradle - Android - In App Review causes compile error - Amplify old dependency

I am trying to integrate In App Review and I get this compile error:
Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
Edit: I ran the command: ./gradlew app:dependencies >> deps.txt
and found out that the conflict is caused by Amplify core. It has a dependency on androidx.navigation:navigation-dynamic-features-fragment:2.3.4 for some reason and that's has com.google.android.play:core:1.9.1 inside.
How can I prevent Amplify causing this? How to solve this confilct?
Here is the dependency tree
I was able to solve this by changing the gradle file:
// gradle imports from Amplify docs below.
implementation('com.amplifyframework:aws-storage-s3:1.35.4') {
exclude group: 'com.google.android.play', module: 'core'
}
implementation('com.amplifyframework:aws-auth-cognito:1.35.4') {
exclude group: 'com.google.android.play', module: 'core'
}
// Amplify core dependency
implementation('com.amplifyframework:core:1.35.4') {
exclude group: 'com.google.android.play', module: 'core'
}

Duplicate classes found in Gradle when trying to use Paging Library 3

I am trying to implement paging using Paging Library 3. However, I cannot run my project after doing all the necessary steps (paging source, flow, and etc). This is the list of my dependencies:
Duplicate class kotlinx.coroutines.AbstractCoroutine found in modules jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1)
Duplicate class kotlinx.coroutines.Active found in modules jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1)
Duplicate class kotlinx.coroutines.AwaitAll found in modules jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1)
Duplicate class kotlinx.coroutines.AwaitAll$AwaitAllNode found in modules jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1)
Duplicate class kotlinx.coroutines.AwaitAll$DisposeHandlersOnCancel found in modules jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1) and jetified-kotlinx-coroutines-core-jvm-1.4.1.jar (org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1)
It's not the full stack trace. Some of my dependencies:
// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
// Paging
implementation 'androidx.paging:paging-runtime-ktx:3.0.0-alpha12'
// Image Compressor
implementation 'id.zelory:compressor:3.0.0' // this lib also uses coroutines
Also, I've tried excluding some dependencies this way:
implementation 'androidx.paging:paging-runtime-ktx:3.0.0-alpha12' {
exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-coroutines-core-jvm'
But it produces the following error:
A problem occurred evaluating project ':app'.
> Could not find method androidx.paging:paging-runtime-ktx:3.0.0-alpha12() for arguments [build_cmaofa0fil3wjmmcunq4oc9m5$_run_closure2$_closure8#2e68c056] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I tried running an example project downloaded from a raywenderlich tutorial and it runs fine with the same dependencies. Migrating to Paging v2 resolves the issue but I would like to use the new functionality in the updated version.
You should write the dependency like this to avoid using from the below-stated module and group. You can also check for the module and/or package with the duplicate classes by checking the error message and pasting it here.
implementation ('androidx.paging:paging-runtime:3.0.0-alpha12') {
exclude group: 'org.jetbrains.kotlinx', module: 'kotlinx-coroutines-core-jvm'
}
it looks like you are using wrong dependency. change to below line :
implementation "androidx.paging:paging-runtime:3.0.0-alpha12"
BTW, I had to use a stable version of paging.
For me, the below solution worked. I hope this solution also might be helpful in some cases.
implementation ('androidx.paging:paging-runtime-ktx:3.0.0') {
exclude group: 'org.jetbrains.kotlinx'
}

Different libraries depend on the same library and will prompt "Duplicate class" during compilation. How to exclude this duplicate class?

error like this:
Duplicate class com.google.android.exoplayer2.ui.AspectRatioFrameLayout found in modules jetified-VideoPlayModule-Lite-2.3.61-runtime.jar (com.ycjiang:VideoPlayModule-Lite:2.3.61) and jetified-exoplayer-ui-2.12.1-runtime.jar (com.google.android.exoplayer:exoplayer-ui:2.12.1)
Duplicate class com.google.android.exoplayer2.ui.AspectRatioFrameLayout$1 found in modules jetified-VideoPlayModule-Lite-2.3.61-runtime.jar (com.ycjiang:VideoPlayModule-Lite:2.3.61) and jetified-exoplayer-ui-2.12.1-runtime.jar (com.google.android.exoplayer:exoplayer-ui:2.12.1)
gradle:
implementation 'com.google.android.exoplayer:exoplayer:2.12.1'
implementation 'com.ycjiang:VideoPlayModule:2.3.61'

Duplicate class com.google.api.client.http.apache.ApacheHttpRequest found in modules

I am trying to migrate to drive v3 api for my android app and I have followed instructions provided inhttps://github.com/gsuitedevs/android-samples/tree/master/drive/deprecation to migrate. I am getting dependency resolution errors.
I have used duplicate classes shown in log in exclude option but it haven't worked
list of my drive api dependencies
implementation 'com.google.android.gms:play-services-ads:17.2.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.http-client:google-http-client-gson:1.29.1'
implementation('com.google.api-client:google-api-client-android:1.28.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev99-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
Below are the error lines shown
Duplicate class com.google.api.client.http.apache.ApacheHttpRequest found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Duplicate class com.google.api.client.http.apache.ApacheHttpResponse found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Duplicate class com.google.api.client.http.apache.ApacheHttpTransport found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Duplicate class com.google.api.client.http.apache.ContentEntity found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Duplicate class com.google.api.client.http.apache.HttpExtensionMethod found in modules google-http-client-1.29.1.jar (com.google.http-client:google-http-client:1.29.1) and google-http-client-apache-2.0.0.jar (com.google.http-client:google-http-client-apache:2.0.0)
Looking at the error message:
found in modules google-http-client-1.29.1.jar
it seems to reference:
implementation 'com.google.http-client:google-http-client-gson:1.29.1'
Based upon the version number. Have you tried to exclude the library from that artefact too?

Android build error when implementing google places sdk

Hello everyone I am developing simple food delivery android application so its required to integrate google maps and auto suggestion I follow to find current location
[google sample code](https://github.com/googlemaps/android-samples/blob/master/tutorials/CurrentPlaceDetailsOnMap/app/src/main/java/com/example/currentplacedetailsonmap/MapsActivityCurrentPlace.java)
and for Auto suggestions I followed
https://developers.google.com/places/android-sdk/autocomplete
when build it gradle shows duplicate class error
Duplicate class com.google.android.libraries.places.api.internal.impl.net.pablo.AutocompletePredictionResult found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.api.internal.impl.net.pablo.AutocompletePredictionResult$StructuredFormatting found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.api.internal.impl.net.pablo.AutocompletePredictionResult$Substring found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.api.internal.impl.net.pablo.FetchPlacePabloResponse found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.internal.bc found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.internal.bd found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
Duplicate class com.google.android.libraries.places.internal.be found in modules classes.jar (com.google.android.libraries.places:places-compat:1.1.0) and classes.jar (com.google.android.libraries.places:places:1.1.0)
And this my gradle
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation 'com.google.android.libraries.places:places:1.1.0'
i try to exclude duplicate classes by below way
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation ('com.google.android.libraries.places:places:1.1.0'){
exclude group:'com.google.android.libraries.places.api.internal.impl.net.pablo'
exclude group: 'com.google.android.libraries.places.internal'
}
But no thing can solve my problem.
Remove
implementation'com.google.android.libraries.places:places-compat:1.1.0'
and keep only implementation 'com.google.android.libraries.places:places:1.1.0'.
Using implementation 'com.google.android.libraries.places:places-compat:1.1.0'
is neccessary only if you are using deprecated library of
implementation 'com.google.android.gms:play-services-places:16.0.0'
Please take a look here and documentation.

Categories

Resources