본문 바로가기
IT 인프라, 개발

[ReactNative] error :Duplicate class androidx.appcompat....

by 조율러 2022. 6. 15.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class androidx.appcompat.content.res.AppCompatResources found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)

problem about Libary depwndencies    for me 

androidx.appcompat:appcompat:1.0.2  <-> androidx.appcompat:appcompat-resources:1.3.1

using same class

error log

* What went wrong:
Execution failed for task ':app:checkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class androidx.appcompat.content.res.AppCompatResources found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.content.res.AppCompatResources$ColorStateListCacheEntry found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$1 found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$AnimatableTransition found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$AnimatedStateListState found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$AnimatedVectorDrawableTransition found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$AnimationDrawableTransition found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$FrameInterpolator found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat$Transition found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.DrawableContainer found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.DrawableContainer$1 found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.DrawableContainer$BlockInvalidateCallback found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.DrawableContainer$DrawableContainerState found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.DrawableWrapper found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.StateListDrawable found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.graphics.drawable.StateListDrawable$StateListState found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.widget.DrawableUtils found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.widget.ResourcesWrapper found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.widget.TintContextWrapper found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.widget.TintInfo found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.widget.TintResources found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     Duplicate class androidx.appcompat.widget.VectorEnabledTintResources found in modules appcompat-1.0.2-runtime (androidx.appcompat:appcompat:1.0.2) and jetified-appcompat-resources-1.3.1-runtime (androidx.appcompat:appcompat-resources:1.3.1)
     
     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.

And... I spend few days for fix this problem, finally I made it!!
I just specify the version of androidx.appcompat:appcompat to 1.3.0

// android/app/build.gradle
implementation "androidx.appcompat:appcompat:1.3.0" //add this line


Actually It was very-basic in Android development. It's all about lib dependency

1. First I check error log 
2.search by error message and find what is actually wrong : Libarary dependency in my case
3.I just check dependencies of modules and find what exactly wrong
https://stackoverflow.com/questions/21645071/using-gradle-to-find-dependency-tree

 

Using Gradle to find dependency tree

Is it possible to use Gradle to produce a tree of what depends on what? I have a project and would like to find out all the dependencies so I may be able to prune it a little with forward declarati...

stackoverflow.com

4. and fix by modify version what I use

댓글