react-native-unity-demo icon indicating copy to clipboard operation
react-native-unity-demo copied to clipboard

Error when run demo

Open TunTin opened this issue 2 years ago • 4 comments

When I run your demo on Emulator or Device I get the above error, please help me to solve it, thanks

image

TunTin avatar Mar 04 '22 11:03 TunTin

It's quite hard to resolve dependencies. Alternative solution is bundling RN source code files in release mode then checking const keyword in this file instead.

To do this thing, use this command at the RN root folder: npx react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/react/release/index.android.bundle --assets-dest ./android/app/src/main/res

Note that you should create android/app/src/main/assets/react/release folder before execute this command.

I already check this for you so I certainly sure that this error no longer exist in bundling file. But you'll get another error. "That's how things works".


FYI, later versions of RN using assets/index.android.bundle instead of assets/react/release/index.android.bundle so you may need to change the path to bundle file if you consider upgrate RN version.

ThinhVu avatar Mar 10 '22 17:03 ThinhVu

If you see an error about String resource 0x0, add these 2 lines of code to strings.xml and it'll work.

<string name="game_view_content_description">Game view</string>
<string name="unity_root">unity_root</string>

ThinhVu avatar Mar 10 '22 17:03 ThinhVu

Or you can use my forked repo instead:

https://github.com/ThinhVu/react-native-unity-demo

ThinhVu avatar Mar 10 '22 18:03 ThinhVu

Thank you, I will try it.

TunTin avatar Mar 14 '22 03:03 TunTin