I'm currently having this error when I build my react native project using android studio. How do I fix this and remove the duplicates.
Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector found in modules imagepipeline-base-2.2.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.2.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfo found in modules imagepipeline-base-2.2.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.2.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
Duplicate class com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfoEntry found in modules imagepipeline-base-2.2.0-runtime.jar (com.facebook.fresco:imagepipeline-base:2.2.0) and stetho-2.0.0-runtime.jar (com.facebook.fresco:stetho:2.0.0)
This seems to be caused by conflicts between Flipper and Fresco. Add this to the app level build.gradle:
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
exclude group:'com.facebook.fresco'
}
(FLIPPER_VERSION is defined in gradle.properties as 0.33.1)
I had a similar error when I upgraded my React Native project to 0.68.2.
Solved this by updating the Flipper SDK version. The flipper version was 0.33.1 and changed it to 0.99.0.
Credits
I had the same error. Removing the following code from package.json the dependencies worked for me:
"react-native-photo-view": "github:shoutem/react-native-photo-view#0ffa1481f6b6cb8663cb291b7db1d6644440584d"
I'm not really sure why but maybe because that's where the duplication is.
Related
Recently I started to develop and Android Kotlin project and I need to use the BigQuery library (from Google). According to the documentation, it not exists any client library developed in Kotlin but I reviewed the Java library so I decided to impor it...
When I put the gradle statement in app-module of my project:
implementation platform('com.google.cloud:libraries-bom:26.1.5')
implementation 'com.google.cloud:google-cloud-bigquery'
I got this ouput error:
Duplicate class org.jetbrains.annotations.NotNull found in modules annotations-13.0 (org.jetbrains:annotations:13.0) and auto-value-1.10 (com.google.auto.value:auto-value:1.10)
Duplicate class org.jetbrains.annotations.Nullable found in modules annotations-13.0 (org.jetbrains:annotations:13.0) and auto-value-1.10 (com.google.auto.value:auto-value:1.10)
Go to the documentation to learn how to Fix dependency resolution errors.
Could you help someone, please?
In order to solve it, I tried the following:
In build.gradle [app-module]:
configurations {
cleanedAnnotations
implementation.exclude group: 'org.jetbrains' , module:'annotations'
}
and
configurations {
cleanedAnnotations
implementation.exclude group:'com.google.auto.value' , module:'auto-value:1.10'
}
but still not working.
In build.gradle [app-module] in "android{}" section:
configurations.all {
resolutionStrategy {
exclude group: "org.jetbrains", module: "annotations-13.0"
}
}
but I didn't get any success....
In my Android app, I added a new dependency in the Gradle file. It turned out that this dependency is conflicting with one of the other dependencies in the project. When I'm trying to build the app I get the following error:
Duplicate class android.content.pm.IPackageStatsObserver found in modules jetified-androidcommon-debug-1.2.2-runtime (com.myapp.androidcommon:androidcommon-debug:1.2.2) and jetified-framework-1.12.0-runtime (com.dependency:framework:1.12.0)
Duplicate class android.content.pm.IPackageStatsObserver$Stub found in modules jetified-androidcommon-debug-1.2.2-runtime (com.myapp.androidcommon:androidcommon-debug:1.2.2) and jetified-framework-1.12.0-runtime (com.dependency:framework:1.12.0)
Duplicate class android.content.pm.IPackageStatsObserver$Stub$Proxy found in modules jetified-androidcommon-debug-1.2.2-runtime (com.myapp.androidcommon:androidcommon-debug:1.2.2) and jetified-framework-1.12.0-runtime (com.dependency:framework:1.12.0)
As the log shows the problem is 3 duplicated classes that are present in both dependencies. To solve this I tried to exclude the android.content.pm package from one or the other dependency like that:
implementation ('com.dependency:framework:1.12.0') {
exclude group: 'android.content.pm'
}
or like that:
implementation('com.myapp.androidcommon:androidcommon-debug:1.2.2') {
exclude group: 'android.content.pm'
}
but I keep getting the same error. Any idea how to solve this issue?
I am using admob and facebook for ads in my app and its done but I want to check it so i have added Mediation Test Suite depnedancy
implementation 'com.google.android.ads:mediation-test-suite:2.0.0'
And the app could not build it shows
Duplicate class com.google.android.flexbox.AlignContent found in modules jetified-flexbox-1.1.1-runtime (com.google.android:flexbox:1.1.1) and jetified-flexbox-3.0.0-runtime (com.google.android.flexbox:flexbox:3.0.0)
Duplicate class com.google.android.flexbox.AlignItems found in modules jetified-flexbox-1.1.1-runtime (com.google.android:flexbox:1.1.1) and jetified-flexbox-3.0.0-runtime (com.google.android.flexbox:flexbox:3.0.0)
And many more Duplicate Class of Flexbox
my admob version
implementation 'com.google.android.gms:play-services-ads:20.4.0'
The package name is wrong.
com.google.android:flexbox:1.1.1
Here is the correct one. ↓
implementation ('com.google.android.ads:mediation-test-suite:2.0.0') {
exclude group: "com.google.android", module: "flexbox"
}
It worked for me.
Exclude the flexbox module which is causing the conflict like this...
implementation ('com.google.android.ads:mediation-test-suite:2.0.0') {
exclude group: "com.google.android.flexbox", module: "flexbox"
}
I am currently facing a Duplicate class RuntimeException. In our current use case we are producing an artifact which is using com.journeyapps:zxing-android-embedded. Our client wants to include our artifact but they are getting a RuntimeException during the compilation.
The Exception occurs because they are using com.google.zxing which is currently clashing with the journeyapps port of zxing which we are using. Journeyapps did a port of the ZXing Android application as an Android library project, for embedding in an Android application.
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Duplicate class com.google.zxing.client.android.camera.CameraConfigurationUtils found in modules android-core-3.3.0.jar (com.google.zxing:android-core:3.3.0) and classes.jar (com.journeyapps:zxing-android-embedded:3.6.0)
Go to the documentation to learn how to Fix dependency resolution errors.
at com.android.ide.common.workers.ExecutorServiceAdapter.await(ExecutorServiceAdapter.kt:56)
... 71 more
Caused by: java.lang.RuntimeException: Duplicate class com.google.zxing.client.android.camera.CameraConfigurationUtils found in modules android-core-3.3.0.jar (com.google.zxing:android-core:3.3.0) and classes.jar (com.journeyapps:zxing-android-embedded:3.6.0)
Go to the documentation to learn how to Fix dependency resolution errors.
at com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable.run(CheckDuplicateClassesDelegate.kt:132)
at com.android.ide.common.workers.ExecutorServiceAdapter$submit$submission$1.run(ExecutorServiceAdapter.kt:40)
... 72 more
I have tried to exclude the duplicate classes inside the gradle build file. Using the following code and vise versa.
implementation("com.google.zxing:android-core:3.3.0")
implementation("module which includes com.journeyapps:zxing-android-embedded:3.6.6") {
exclude group: 'com.google.zxing', module: 'android-core'
}
Without a solution.
I even tried to exclude the module inside the configuration. If I do so it is missing during the insertion of the dependencies.
You can reproduce the error using the following code
implementation("com.google.zxing:android-core:3.3.0")
implementation("com.journeyapps:zxing-android-embedded:3.6.0")
As I tried to solve the problem for a lot of hours without a solution, I am very thankful for every advise.
this solve for me
add below code in Android/app/build.gradle file
configurations {
compile.exclude group: 'com.google.zxing'
}
try using this transitive flag maybe this can help you out
implementation("module which includes com.journeyapps:zxing-android-embedded:3.6.6") {
exclude group: 'com.google.zxing', module: 'android-core'
transitive = false
}
We came to the conclusion that we can not exclude the dependencies because their is a naming issue in case of some classes with com.journeyapps:zxing and com.google.zxing.
We ended up migrating our libary from com.journeyapps:zxing to com.google.zxing.
Thanks to PJain for the advise.
Thanks to your comments I solved the issue like below image
dependencies {
configurations.all {
exclude group: 'com.google.zxing'
}
}
android {
compileSdkVersion 33
defaultConfig {
minSdkVersion 17
generatedDensities = []
multiDexEnabled true
versionCode 1
versionName "1.0.0"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
Updating AndroidStudio this week I was forced to add AnnotationProcessor:
(Don't even understand what for.)
Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration. kotlin-compiler-embeddable-1.3.11.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.11)
So I added to my app.build.gradle:
dependencies {
...
annotationProcessor "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
...
}
But now I can't get rid of the following errors:
Run tasks :app:checkDebugDuplicateClasses
> Duplicate class found in modules annotations-13.0.jar (org.jetbrains:annotations:13.0) and kotlin-compiler-embeddable-1.3.11.jar (org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.11)
I don't know where org.jetbrains:annotations:13.0 is declared/imported in my gradles or settings.
How can I solve this error?
I was getting a similar Gradle error stating duplicate class found in annotations when I tried to use kotlin in some Old project. In my case, I have to remove the following dependency which was causing conflict with kotlin's annotation module.
implementation 'org.jetbrains:annotations-java5:17.0.0'
I got similar error due to some libraries using different versions of the same intellij annotation library.
I run app:dependencies and found that library com.xx.yy is using intellij.annotations.12 dependency. So I exclude that for that library only with
implemenation ("com.xx.yy:1.2.3") {
exclude group: 'com.intellij', module: 'annotations'
}
./gradlew app:dependencies
check all dependencies