Closed realchiu closed 5 years ago
Hello @realchiu
I also used viro static lib with react-native, and seems everything going well.
I remember the reason is react-native-vector-icon
cannot successful build which created by react-viro init. So I create react-native project intergeted the Viro SDK.
My package.json.
...
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.1",
"react-native-elements": "^1.0.0-beta7",
"react-native-gesture-handler": "^1.0.10",
"react-native-vector-icons": "^6.1.0",
"react-navigation": "^3.0.5",
"react-viro": "2.12.0"
}
...
Then init ios build and create Podfile.(Be sure cocoapods already installed)
platform :ios, '9.3'
target 'RNViroDemos' do
pod 'ViroReact', :path => '../node_modules/react-viro/ios/'
pod 'ViroKit_static_lib', :path => '../node_modules/react-viro/ios/dist/ViroRenderer/static_lib'
end
Execute pod install
in $<PROJECT_DIR>/ios
.
My rn-cli.config.js
'use strict';
const path = require('path');
module.exports = {
getProjectRoots() {
return this._getRoots();
},
getAssetRoots() {
return this._getRoots();
},
getAssetExts() {
return ["obj", "mtl", "JPG", "PNG", "mp4", "vrx", "hdr", "gltf", "glb", "bin", "arobject"];
},
_getRoots() {
// match on either path separator
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {
// packager is running from node_modules of another project
return [path.resolve(__dirname, '../../..')];
} else if (__dirname.match(/Pods\/React\/packager$/)) {
// packager is running from node_modules of another project
return [path.resolve(__dirname, '../../..')];
} else {
return [path.resolve(__dirname, '.')];
}
},
};
Open $<PROJECT_NAME>.xcworkspace
in Xcode.(My is Xcode 10) and config Provision profile\Certificate.
And I use react-native command react-native run-ios --device="My iPhone"
, everything is up.
Sometimes there are werid errors when build.
That's some of problems I have encountered.
Xcode 10 third-party error. Sometimes glog-0.3.4 config.h not found
In the Terminal, navigate to the react-native/third-party/glog folder inside node_modules (for me, this was cd node_modules/react-native/third-party/glog-0.3.4)
Once actively in this folder, run ../../scripts/ios-configure-glog.sh
Glog is configured and the required config.h header file is created for Xcode to find
Xcode 10 libfishhook.a missing.
- remove libfishhook.a from RCTWebSocket.xcodeproj and reimport. This should be executed in Xcode and in Libraries - RCTWebSocket.xcodeproj - Build Phases
I found above errors always occurs after react-native recomplied.
Before ios building, you don't need to manually compile the main.jsbundle.
Good luck.
Thank you for your help but I cannot create a new project integrated with Viro SDK because I have already built a quite large project. This issue happens when I wants to integrate react viro with my existing project. But the main problem is that It works perfectly fine in android, but not IOS. I have struggled in this issue for almost 2 weeks but still cannot find a way to solve it.
Hi @realchiu, A few things to try:
1) Since you are using a debug build, do you see the application making a request for the resource on the ngrok or package server on your machine?
2) can you try renaming the files to not include the postfix: ie, xxx_obj.obj-> xxx.obj.
3) Please attach the model and textures to this issue or email them to us at support@viromedia.com so we can test your model specifically so we can debug.
4) Do you have any log files you can send us that describe the error?
5) Do other models work for you? If you remove this problem model and try another model with textures does that work fine?
Yes, from the metro bundler but just some error messages.
Originally my files' names are without the postfix. So with/without the postfix will still give the error.
I will do it in a moment. Thank you.
May you tell me where can I find these log files? I only got error log from the terminal.
Loading dependency graph, done. error: bundling failed: Error: Unable to resolve module
../model/earthworm/earthworm.obj
from*my_project_folder_root*/src/views/ARExploreView.js
: The module../model/earthworm/earthworm.obj
could not be found from*my_project_folder_root*/src/views/ARExploreView.js
. Indeed, none of these files exist:
earthworm.obj
*my_project_folder_root*/src/model/earthworm/earthworm.obj/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)
at ModuleResolver.resolveDependency (my_project_folder_root/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:161:851)
at ResolutionRequest.resolveDependency (my_project_folder_root/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:91:16)
at DependencyGraph.resolveDependency (my_project_folder_root/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:272:4579)
at dependencies.map.relativePath (my_project_folder_root/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:376:19)
at Array.map (I have in total of 5 obj models with mtl but only 4 of them are working. Textures with format jpg(not JPG) can be loaded successfully.
Sorry that the problem is suddenly solved with no reasons...I don't know what has happened, but let me close the issue first. I will reopen this issue if there are any follow ups.
I was implementing viro in my existing project and same issue was coming . I was using "react-native 0.57.7" and "react-viro 2.12.0"
After reading docs I have found that "react-viro v2.12.0" is compatible with "React Native v0.55.1"
I have Downgraded react native version to "0.55.1" and issue fixed.
Environment
Please provide the following information about your environment:
Description
It keeps on saying failed to load bundle, unable to resolve module xxxxxx.obj/mtl/jpg. But In android model can be loaded perfectly. I have made sure the path is absolutely correct, and all the file names are correct. I have also tried to modify the name as xxxx_obj.obj or xxxx_mtl.mtl, but it still does not work.
My podfile code of viroreact are as follow: pod 'ViroReact', :path => '../node_modules/react-viro/ios/' pod 'ViroKit_static_lib', :path => '../node_modules/react-viro/ios/dist/ViroRenderer/static_lib' to avoid one build error(but I forgot what exactly the error was).
I have added rn-cli.config, but it seems xcode does not import it.
Sometimes this error will disappear, but with another exception with code lldb is thrown.
Reproducible Demo
require obj/mtl/jpg in the react native code, and have a debug build on ios devices like iphoneX and iphone 6.