th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.09k stars 191 forks source link

Build failed - Duplicate classes in RN 0.71 new arch #359

Closed simonkoeck closed 1 year ago

simonkoeck commented 1 year ago

I've received the following error after upgrading to 0.71

A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingTaskDelegate
   > There was a failure while executing work items
      > A failure occurred while executing com.android.build.gradle.internal.tasks.DexMergingWorkAction
         > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
           Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
           Type com.facebook.react.viewmanagers.RNCSafeAreaProviderManagerDelegate is defined multiple times: 
...
jacobp100 commented 1 year ago

Are you 100% sure you don’t have this package twice in your node_modules?

arcln commented 1 year ago

You have to properly clean your build folder when changing newArch value otherwise you'll have duplicate class errors.

cd android
./gradlew clean
rm -rf build app/build