The demo launched properly on the emulator. Next step is adding BabylonReactNative.
npm i @babylonjs/react-native
npx react-native run-android
Which gave me this output:
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\Olivier\Documents\dev\systemic\babylon\Playground\node_modules\@babylonjs\react-native\android\build.gradle' line: 27
* What went wrong:
A problem occurred evaluating project ':babylonjs_react-native'.
> Plugin with id 'maven' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':babylonjs_react-native'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
I’ve also tried using the latest version of ReactNative instead of 0.65.
I’m running on Win10 21H2.
React Native in package.json should be 0.65. We’ve not tested with react native 0.65.
Maybe the script to generate the project is not good on Windows. I’ve generated the app for iOS/Android on a Mac.
Yea the React Native CLI seems broken. I think for now you have to create a new React Native app without the TypeScript template arg (which will allow you to select the right version of RN), then update your project to use TypeScript.
Indeed it builds on Windows when not using the typescript template.
For anyone reading this, be sure to request version 0.65 so to get the latest 0.65 patch. If you use 0.65.0 with the trailing 0 you will get a package dependency error on install.
Apologies for bugging you again, but I now have a runtime error:
Error: Protocol version mismatch: 2 (Native) !== 3 (JS)
This looks like a Babylon error from here:
Babylon.js => src/Engines/nativeEngine.ts
This can’t be right. There is no @babylonjs/core here. Also, @babylonjs/loaders on 4.2.1 shouldn’t work since you have to be at least on 5.0.0 for this to work.
@babylonjs/loaders has a dependency on @babylonjs/core, so the app will transitively have a dependency on @babylonjs/core (it doesn’t need to be listed explicitly). Try to install @babylonjs/loaders@5.0.0-alpha.65.
Also, you should see an error in the metro console window telling you the minimum Babylon.js version you need to use.
The following work-flow works for the Sample project:
git clone GitHub - BabylonJS/BabylonReactNativeSample webxr
cd webxr
git checkout react-native-0-69
npm install
npm run android