BabylonReactNative icon indicating copy to clipboard operation
BabylonReactNative copied to clipboard

Adding BabylonReactNative to a project already containing packages that require ARCore may fail to build

Open dmegue opened this issue 3 years ago • 6 comments

Adding BabylonReactNative to a project containing Viro React Community(https://github.com/ViroCommunity/viro) fails to build:

[: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`

Both require ARCore 1.14.0, but Viro React targets Android SDK 24 whilst BabylonReactNative targets SDK 28.

dmegue avatar May 08 '21 03:05 dmegue

Removing implementation 'com.google.ar:core:1.14.0' from Babylon build.gradle fixed the issue for now. Playground scene is running with no issues whatsoever.

dmegue avatar May 08 '21 03:05 dmegue

Hi @dmegue Are you referring to this particular line to remove ? https://github.com/BabylonJS/BabylonReactNative/blob/5463b3a5605eb10ade59ade2eeab42cd65442820/Modules/%40babylonjs/react-native/android/build.gradle#L128

CedricGuillemet avatar Jun 07 '21 13:06 CedricGuillemet

I think we still need that one because that is the project that ultimately compiles all the Babylon Native code for Android. I think the one we want to remove is this one: https://github.com/BabylonJS/BabylonReactNative/blob/master/Package/Android/build.gradle#L80. That's the one @dmegue tested removing in their project.

A bit more context here: https://forum.babylonjs.com/t/issue-setting-up-babylonjs-on-rn/20647/5?u=ryantrem

ryantrem avatar Jun 07 '21 15:06 ryantrem

Hi @CedricGuillemet the one i removed was the one @ryantrem linked above

https://github.com/BabylonJS/BabylonReactNative/blob/master/Package/Android/build.gradle#L80. That's the one @dmegue tested removing in their project.

dmegue avatar Jun 07 '21 19:06 dmegue

Since things blow up if ARCore is not included, then I think ideally we would detect from the BRN gradle file whether ARCore is already included in the project, and only include it ourselves if the host project is not including it. If that is not possible, then a simpler (but less "automatic") solution would be to include ARCore by default, but allow the consuming project to set some variable that tells our gradle not to include ARCore.

ryantrem avatar Jan 20 '22 19:01 ryantrem

Hello 👋

Any updates on this ?

gregoryalary avatar Mar 08 '23 14:03 gregoryalary

hi @gregoryalary 1 year without update. :/ Sorry for that. Is it still a need on your side?

CedricGuillemet avatar Apr 18 '24 14:04 CedricGuillemet

Hi @CedricGuillemet, if i recall correctly we decided to pick another library.

gregoryalary avatar Apr 18 '24 14:04 gregoryalary