I’m trying to to make the user take a photo with “expo-image-picker” module using the “launchCameraAsync” function, and at first everything worked out fine, but now when trying to make the user take a photo, expo throws an warning and does not activate the camera, the warning is:
Possible Unhandled Promise Rejection (id: 0): Error: Call to function ‘ExponentImagePicker.launchCameraAsync’ has been rejected. → Caused by: java.lang.RuntimeException: Can’t create handler inside thread Thread[DefaultDispatcher-worker-2,5,main] that has not called Looper.prepare()
The code section responsible for this error is:
const permission = await ImagePicker.requestCameraPermissionsAsync(); if (permission.granted === false) //Error handeling console.log(permission); let result = await ImagePicker.launchCameraAsync({ base64: false, mediaTypes: ImagePicker.MediaTypeOptions.Images, allowsEditing: true, aspect: [3, 2], quality: 1, }); console.log(result); if (!result.cancelled) { console.log(result.uri); setImages({ ...images, document: result.uri }); }
I believe the error may be due to incompatibility with other expo modules but I’m not sure because I have not updated or changed the modules in my app, either way here are the versions of what I believe are the relevant modules.
"expo": "~46.0.16", "expo-image-picker": "~13.3.1", "expo-updates": "~0.14.6",
Advertisement
Answer
I also face the same problem just yesterday. and everything solve when I clear the memory of the app. you can try if its work for you too