Android Studio 3.4.1 Build Exception in Map Sample - android

I have recently updated my Android studio to 3.4.1. I am planning to integrate Geofencing Application. So I have downloaded the Map Application from the Google sample git repository and import it to new Android studio. But I am getting the below error continuously while building the application.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.1) and classes.jar (com.android.support:support-compat:26.1.0)
Go to the documentation to learn how to Fix dependency resolution errors.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 18s
16 actionable tasks: 12 executed, 4 up-to-date

Related

Unity android gradle build fails duplicate class

I have been looking for the last few days for a solution to my problem. I have multiple SDKs imported in my project (firebase, facebook, admob, etc) and it was all working fine.
But I then needed to import a AndroidInstallReferrer plugin (this one: https://assetstore.unity.com/packages/tools/integration/android-install-referrer-179422)
And after importing it (it consists of a .jar and an .aar basically) I can't build an APK anymore.
This is the error I get:
Note: D:\Work\MyProject\Project\Temp\gradleOut\unityLibrary\src\main\java\com\unity3d\player\UnityPlayerActivity.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class com.android.installreferrer.api.InstallReferrerClient found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.InstallReferrerClient$1 found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.InstallReferrerClient$Builder found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.InstallReferrerClient$InstallReferrerResponse found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$1 found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$ClientState found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.InstallReferrerClientImpl$InstallReferrerServiceConnection found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.InstallReferrerStateListener found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.api.ReferrerDetails found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.android.installreferrer.commons.InstallReferrerCommons found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService$Stub found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Duplicate class com.google.android.finsky.externalreferrer.IGetInstallReferrerService$Stub$Proxy found in modules jetified-installreferrer-1.0-runtime.jar (com.android.installreferrer:installreferrer:1.0) and jetified-installreferrer-2.1-runtime.jar (:installreferrer-2.1:)
Go to the documentation to learn how to Fix dependency resolution errors.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 59s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Any help is greatly appreciated. Also, the jar resolver doesn't work, jetifier and androidx are enabled in gradleTemplate; multidex is enabled in launcher template.

How to resolve duplicate class exception caused by com.google.firebase:firebase-ml-vision:24.0.0

While setting up the Text Recognizer for MLKit on Android for a react-native project (following this tutorial: https://firebase.google.com/docs/ml-kit/android/recognize-text?authuser=0) I face an exception when launching the application with the react-native run-android command in my terminal.
It states I have duplicate classes and I tracked it down to when I add implementation 'com.google.firebase:firebase-ml-vision:24.0.0' to the app/build.gradle
Has anyone faced this before and resolved it? If I remove that line and change line 134 of android/app/build Gradle back to 'general' from 'mlkit' I can run my react-native-camera module but I cannot interface with the MLKit text recognizer.
Exception:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class com.google.android.gms.internal.vision.zzbm found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzck found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzcl found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzcm found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzjx found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzjy found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzjz found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzka found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzkb found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzkc found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzkd found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzke found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzkg found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)
Duplicate class com.google.android.gms.internal.vision.zzl found in modules classes.jar (com.google.android.gms:play-services-vision-common:19.0.0) and classes.jar (com.google.firebase:firebase-ml-vision-face-model:17.0.2)

Duplicate class android.support.v4. found in modules classes.jar (com.android.support:support-compat:28.0.0)

I am getting a dependency duplicate issue please help.
error details: "Cause 1: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Duplicate class android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat found in modules classes.jar (com.android.support:support-compat:28.0.0) and classes.jar (com.android.support:support-v4:24.0.0)

found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)

I try to add firebase-core:17.0.0 in dependency but it display this error. I don't want to my code migrate into androidX :-
Duplicate class android.support.v4.app.INotificationSideChannel found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.IResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.core.graphics.drawable.IconCompatParcelizer found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.core.internal.package-info found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:28.0.0)
Duplicate class androidx.versionedparcelable.CustomVersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.NonParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelField found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelImpl found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelImpl$1 found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.ParcelUtils found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel$1 found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcel$ParcelException found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelParcel found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream$FieldBuffer found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelStream$InputBuffer found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelable found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Duplicate class androidx.versionedparcelable.VersionedParcelize found in modules classes.jar (androidx.versionedparcelable:versionedparcelable:1.0.0) and classes.jar (com.android.support:versionedparcelable:28.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
but when i add this lines run perfect :-
configurations.all {
resolutionStrategy.force 'com.google.firebase:firebase-core:17.0.0'
}
but when i add these lines i can't access Firebase Analytics package.
How can i solve it?
I have got the solution to this error.
First, remove this code from your build.gradle file
configurations.all {
resolutionStrategy.force 'com.google.firebase:firebase-core:17.0.0'
}
Here you use the AndroidX supported library in your project. That's why they give you this kind of error.
Please first check firebase blog and confirm the usage library in your project is supported AndroidX. If yes then reduce that library version.

Duplicate classes when building app with firebase-firestore and google-cloud-language - android

I'm getting duplicate class errors when I try to build android app that use firebase-firestore and google-cloud-language.
Duplicate class com.google.api.Advice found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.Advice$1 found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.Advice$Builder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
Duplicate class com.google.api.AdviceOrBuilder found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
...
Duplicate class com.google.type.TimeOfDayProto found in modules classes.jar (com.google.firebase:protolite-well-known-types:16.0.1) and proto-google-common-protos-1.15.0.jar (com.google.api.grpc:proto-google-common-protos:1.15.0)
My build.gradle looks like follow:
...
dependencies {
...
implementation 'com.google.firebase:firebase-ml-vision:20.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
implementation 'io.grpc:grpc-okhttp:1.19.0'
implementation'com.google.cloud:google-cloud-language:1.76.0'
}
How can I solve the issuse ?

Categories

Resources