Gradle build failed for EAS build Android - Duplicate class kotlin

Hi,

I’m trying to publish our apps, it worked fine for iOS but unable to get Android working. The error is about duplicate class kotlin. Searching online I see solutions for RN bare but nothing for expo managed. Any guidance and help would be appreciated.

Setup:

  • Managed Expo
  • React Native 18
  • Expo 46.0.7
  • Expo CLI 6.0.8

Dependencies

"dependencies": {
    "@amplitude/analytics-react-native": "latest",
    "@draftbit/maps": "~46.9.2",
    "@draftbit/ui": "46.9.2",
    "@expo/config-plugins": "^6.0.1",
    "@expo/dev-server": "0.1.120",
    "@expo/vector-icons": "^13.0.0",
    "@expo/webpack-config": "^0.17.0",
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.2.0",
    "@react-native-community/netinfo": "9.3.0",
    "@react-native-community/slider": "4.2.3",
    "@react-native-picker/picker": "2.4.2",
    "@react-navigation/bottom-tabs": "^5.11.15",
    "@react-navigation/drawer": "^5.12.9",
    "@react-navigation/native": "^5.9.8",
    "@react-navigation/stack": "^5.14.9",
    "@shopify/flash-list": "1.1.0",
    "@shopify/mime-types": "^2.1.0",
    "@transak/react-native-sdk": "^1.2.1",
    "@types/react-native": "~0.69.1",
    "expo": "~46.0.7",
    "expo-application": "~4.2.2",
    "expo-asset": "~8.6.3",
    "expo-av": "~12.0.4",
    "expo-blur": "~11.2.0",
    "expo-camera": "~12.5.0",
    "expo-clipboard": "~3.1.0",
    "expo-constants": "~13.2.4",
    "expo-device": "~4.3.0",
    "expo-document-picker": "~10.3.0",
    "expo-file-system": "~14.1.0",
    "expo-font": "~10.2.0",
    "expo-image-picker": "~13.3.1",
    "expo-linear-gradient": "~11.4.0",
    "expo-linking": "~3.2.4",
    "expo-local-authentication": "~12.3.0",
    "expo-localization": "~13.1.0",
    "expo-location": "~14.3.0",
    "expo-notifications": "~0.16.1",
    "expo-permissions": "~13.2.0",
    "expo-screen-orientation": "~4.3.0",
    "expo-sharing": "~10.3.0",
    "expo-splash-screen": "~0.16.2",
    "expo-status-bar": "~1.4.0",
    "expo-store-review": "~5.3.0",
    "expo-web-browser": "~11.0.0",
    "lottie-react-native": "5.1.3",
    "moment": "latest",
    "react": "18.0.0",
    "react-dom": "18.0.0",
    "react-fetch-hook": "1.9.5",
    "react-native": "0.69.9",
    "react-native-chart-kit": "latest",
    "react-native-config": "^1.5.0",
    "react-native-dotenv": "^3.4.8",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-inappbrowser-reborn": "^3.7.0",
    "react-native-keyboard-aware-scroll-view": "~0.9.5",
    "react-native-maps": "0.31.1",
    "react-native-modal-datetime-picker": "^13.0.0",
    "react-native-qrcode-svg": "latest",
    "react-native-safe-area-context": "4.3.1",
    "react-native-screens": "~3.15.0",
    "react-native-svg": "12.3.0",
    "react-native-svg-charts": "latest",
    "react-native-typography": "1.4.1",
    "react-native-web": "~0.18.7",
    "react-native-web-swiper": "^2.2.3",
    "react-native-webview": "11.23.0",
    "react-query": "^3.39.2",
    "react-request": "^3.2.0",
    "typescript": "^4.6.3"
  },
  "resolutions": {
    "react-native-web": "0.18.7"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/react": "~18.0.0"
  }

This is the error I see in the expo.dev logs after running eas build --platform android

[stderr] 
FAILURE: Build completed with 2 failures.
[stderr] 
1:
[stderr] 
Task failed with an exception.
[stderr] 
-----------
[stderr] 
* What went wrong:
[stderr] 
Execution failed for task ':app:checkReleaseDuplicateClasses'.
[stderr] 
>
[stderr] 
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
[stderr] 
   > Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
[stderr] 
     Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
[stderr] 
     Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.io.path.ExperimentalPathApi found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
[stderr] 
     Duplicate class kotlin.io.path.PathRelativizer found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
[stderr] 
     Duplicate class kotlin.io.path.PathsKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
[stderr] 
     Duplicate class kotlin.io.path.PathsKt__PathReadWriteKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
[stderr] 
     Duplicate class kotlin.io.path.PathsKt__PathUtilsKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
[stderr] 
     Duplicate class kotlin.jdk7.AutoCloseableKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21)
[stderr] 
     Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.6.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21)
[stderr] 
     
[stderr] 
     Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
==============================================================================
[stderr] 
2: Task failed with an exception.
[stderr] 
-----------
[stderr] 
* What went wrong:
[stderr] 
Execution failed for task ':app:checkReleaseAarMetadata'.
[stderr] 
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
[stderr] 
   > One or more issues found when checking AAR metadata values:
[stderr] 
     
[stderr] 
     Dependency 'androidx.browser:browser:1.5.0' requires 'compileSdkVersion' to be set to 33 or higher.
[stderr] 
     Compilation target for module ':app' is 'android-31'
[stderr] 
* Try:
[stderr] 
> Run with --stacktrace option to get the stack trace.
[stderr] 
> Run with --info or --debug option to get more log output.
[stderr] 
> Run with --scan to get full insights.
[stderr] 
==============================================================================
[stderr] 
* Get more help at https://help.gradle.org
[stderr] 
BUILD FAILED in 7m 32s