BabylonReactNative icon indicating copy to clipboard operation
BabylonReactNative copied to clipboard

react-native-iosandroid-0-71 Duplicate class a.a.a found in modules core-1.22.0.aar

Open fortyone-41 opened this issue 1 year ago • 4 comments

Describe the bug In library react-native-iosandroid-0-71, in build.gradle there is string: implementation 'com.google.ar:core:1.22.0', which is the reason of error about duplicate class. If i comment it, app starts but works incorrectly (immediately closes)

To Reproduce Steps to reproduce the behavior:

  1. install @babylonjs/react-native-iosandroid-0-71
  2. npx react-native run-android
  3. See error 'Duplicate class a.a.a found in modules core-1.22.0.aar -> core-1.22.0-runtime (com.google.ar:core:1.22.0) and installreferrer-2.2.aar -> installreferrer-2.2-runtime (com.android.installreferrer:installreferrer:2.2)'

Expected behavior App starts

fortyone-41 avatar Oct 06 '24 21:10 fortyone-41

Meanwhile, I found out how i can fix it, but it seems like not a good solution

configurations {
        all*.exclude module: 'installreferrer'
    }

fortyone-41 avatar Oct 08 '24 11:10 fortyone-41

Maybe it's possible to check in BRN gradle file if dependency already exists. Can you please try to add these lines in BaylonReactNative gradle and see if it fixes the issue:

dependencies {
    implementation('com.google.ar:core:1.22.0') {
        exclude group: 'com.google.ar', module: 'core'
    }
...
}

CedricGuillemet avatar Oct 09 '24 09:10 CedricGuillemet

Maybe it's possible to check in BRN gradle file if dependency already exists. Can you please try to add these lines in BaylonReactNative gradle and see if it fixes the issue:

dependencies {
    implementation('com.google.ar:core:1.22.0') {
        exclude group: 'com.google.ar', module: 'core'
    }
...
}

Ive tried it, and it didn't help.

fortyone-41 avatar Oct 09 '24 09:10 fortyone-41

Do get some results at chechking root projects dependencies?

def parentHasDependency(String group, String name) {
    rootProject.configurations.each { config ->
        config.dependencies.each { dep ->
            if (dep.group == group && dep.name == name) {
                return true
            }
        }
    }
    return false
}

if (!parentHasDependency('com.google.ar', 'core')) {
    dependencies {
        implementation 'com.google.ar:core:1.22.0'
    }
}

CedricGuillemet avatar Oct 09 '24 09:10 CedricGuillemet