Issue setting up BabylonJS on RN

Hey guys, I’m new to the framework and having some issues setting it up on RN(@babylonjs/react-native). The problem seems to be related to a conflict between Babylon and Viro React(https://github.com/ViroCommunity/viro) due to ArCore versions i guess. On a fresh project it works just fine, but Viro React is a must for my project.

Thats the error i’m getting:

[:arcore_client] /project/node_modules/react-viro/android/arcore_client/build/.transforms/8a1c382d15b6830d95b4fffc34498914/jetified-core-1.10.0/AndroidManifest.xml Warning:
Package name ‘com.google.ar.core’ used in: :arcore_client, com.google.ar:core:1.14.0.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface
265 actionable tasks: 5 executed, 260 up-to-date
/project/android/app/src/debug/AndroidManifest.xml:35:13-38 Error:
Attribute meta-data#com.google.ar.core.min_apk_version@value value=(190519000) from [:arcore_client] AndroidManifest.xml:35:13-38
is also present at [com.google.ar:core:1.14.0] AndroidManifest.xml:35:13-38 value=(191106000).
Suggestion: add ‘tools:replace=“android:value”’ to element at AndroidManifest.xml:33:9-35:41 to override.

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ‘:app:processDebugMainManifest’.
Manifest merger failed with multiple errors, see logs

Adding ‘tools:replace=“android:value”’ doesn’t seem to fix the issue. Is there anything i can do on the babylonjs end to fix it? i don’t need the webxr functionality for now. Thank you!

Adding @Cedric and @bghgary for help.

It looks like a different version of Android SDK between arcore in BabylonNative and viro.
I’ve found some infos here : add 'tools:replace="Android:value"' to <meta-data> element at AndroidManifest - Stack Overflow
note, tools:replace=“android:value value is an expected Android sdk version.
Also, you can try to change the arcore version in BabylonNative
BabylonNative/build.gradle at 9af6fcc36f3ff60ba0feb75957cad7dd112f8ca4 · BabylonJS/BabylonNative · GitHub
With the same version as viro. Other versions that 1.14 have not been tested with BabylonNative.

1 Like

cc @ryantrem

All the code that uses the ARCore SDK is precompiled, so do we actually even need to reference ARCore in the build.gradle file? @mihuron if you go to the root directory of your React Native app, open node_modules/@babylonjs/react-native/Android/build.gradle and comment out the line that says implementation 'com.google.ar:core:1.14.0' do you get different errors?

3 Likes

Thanks for the help @Cedric and @ryantrem , commenting out implementation 'com.google.ar:core:1.14.0' from Babylon build.gradle as @ryantrem said, fixed the issue, everything working great now.

Thanks!

1 Like

Ok, great! We should do some more testing and see if this breaks any other scenarios, and if not remove it from the source. @mihuron it would be great if you could log in issue on GitHub! Issues · BabylonJS/BabylonReactNative (github.com)

1 Like