-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on simulator, any workaround? #310
Comments
you must run on a physical device, Apple Simulator and Android Emulator don´t acess ARCore (Android) and ARKit (iOS). |
It's not an ideal solution but we solved it by adding this condition to the Podfile if !ENV["EXCLUDE_VIRO"]
puts "adding VIRO.."
pod 'ViroReact', :path => '../node_modules/@reactvision/react-viro/ios'
pod 'ViroKit', :path => '../node_modules/@reactvision/react-viro/ios/dist/ViroRenderer/'
else
puts "removing VIRO.."
end in package.json then someting like this "prepare:simulator": "EXCLUDE_VIRO=true; yarn install" |
I solved this a bit hacky by adding a config I called In My ARScreen: let Viro3DObject: any,
ViroAmbientLight: any,
ViroARPlaneSelector: any,
ViroARScene: any,
ViroARSceneNavigator: any,
ViroMaterials: any,
ViroTrackingStateConstants: any;
if (config.USE_VIRO) {
Viro3DObject = require('@reactvision/react-viro').Viro3DObject;
ViroAmbientLight = require('@reactvision/react-viro').ViroAmbientLight;
ViroARPlaneSelector = require('@reactvision/react-viro').ViroARPlaneSelector;
ViroARScene = require('@reactvision/react-viro').ViroARScene;
ViroARSceneNavigator = require('@reactvision/react-viro').ViroARSceneNavigator;
ViroMaterials = require('@reactvision/react-viro').ViroMaterials;
ViroTrackingStateConstants = require('@reactvision/react-viro').ViroTrackingStateConstants;
}
export default function ArScreen({ route, navigation }: ArScreenProps) {
if (!config.USE_VIRO) {
return (
<View style={styles.placeholderView}>
<Text style={textStyles.h4}>AR is disabled in this build</Text>
</View>
);
}
return (
<ViroARScene
onTrackingUpdated={handleTrackingUpdated}
onAnchorUpdated={(_anchor: any) => setAnchorFound(true)}
>
<ViroAmbientLight color={'#ffffff'} />
<ViroARPlaneSelector>
// other viro stuff
</ViroARPlaneSelector>
</ViroARScene>
);
};
// Setup some way of getting the USE_VIRO config. export const config = {
USE_VIRO: !(process.env.USE_VIRO === 'false')
}; Adding the USE_VIRO env to the scripts: {
"scripts": {
"start:dev": "USE_VIRO=true npx expo start --dev-client -c",
"start:dev-simulator": "USE_VIRO=false npx expo start --dev-client -c",
"build:ios-simulator": "USE_VIRO=false eas build --profile development-simulator --platform ios --local",
"build:ios-dev": "USE_VIRO=true eas build --profile development --platform ios --local",
"build:android-simulator": "USE_VIRO=false eas build --profile development --platform android --local",
"build:android-dev": "USE_VIRO=true eas build --profile development --platform android --local",
},
} |
Requirements:
Environment
Mac, iOS 17.2, iPhone 15 Pro simulator
Bare react native project, non-expo.
Description
Simulator crashes immediately on startup, even without using any viro-react features. I was looking through some previous issues where this is mentioned, but I don't think any of them were actually solved, just closed.
I don't need AR features on a simulator, but it would be nice to run e2e and develop features that are not related to AR on a sim. So, any workarounds? Real device works, of course, but we need simulator to at least not crash.
Trace snippet:
The text was updated successfully, but these errors were encountered: