expo: Unable to use Camera via ImagePicker through Expo Go on Android
Minimal reproducible example
https://github.com/chris-nolan/tunnel-app
Summary
ImagePicker should load the native camera UI and allow a picture to be taken. This works fine when doing a development build, however when running through Expo Go the following error occurs:
WARN Possible Unhandled Promise Rejection (id: 0): Error: Call to function 'ExponentImagePicker.launchCameraAsync' has been rejected. → Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method host.exp.exponent.experience.d.checkSelfPermission, parameter permission Error: Call to function 'ExponentImagePicker.launchCameraAsync' has been rejected. → Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method host.exp.exponent.experience.d.checkSelfPermission, parameter permission at construct (native) at apply (native) at _construct (http://192.168.68.81:19000/index.ts.bundle?platform=android&dev=true&hot=false:3251:28) at Wrapper (http://192.168.68.81:19000/index.ts.bundle?platform=android&dev=true&hot=false:3213:25) at construct (native) at _createSuperInternal (http://192.168.68.81:19000/index.ts.bundle?platform=android&dev=true&hot=false:112723:322) at call (native) at CodedError (http://192.168.68.81:19000/index.ts.bundle?platform=android&dev=true&hot=false:112731:26)
Environment
expo-env-info 1.0.5 environment info: System: OS: Windows 10 10.0.19044 Binaries: Node: 16.13.0 - ~\AppData\Local\Volta\tools\image\node\16.13.0\node.EXE Yarn: 1.22.17 - ~\AppData\Local\Volta\tools\image\yarn\1.22.17\bin\yarn.CMD npm: 8.1.4 - ~\AppData\Local\Volta\tools\image\npm\8.1.4\bin\npm.CMD npmPackages: @expo/webpack-config: ^18.0.1 => 18.0.1 expo: ~48.0.5 => 48.0.5 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.71.3 => 0.71.3 react-native-web: ~0.18.10 => 0.18.12 Expo Workflow: managed
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 59 (4 by maintainers)
Commits related to this issue
- [go][android] Fix requestPermissions NullPointerException (#21912) # Why Closes https://github.com/expo/expo/issues/21544 # How When launching the camera through ExpoImagePicker we check for... — committed to expo/expo by gabrieldonadel a year ago
- [go][android] Fix requestPermissions NullPointerException (#21912) # Why Closes https://github.com/expo/expo/issues/21544 # How When launching the camera through ExpoImagePicker we check for... — committed to expo/expo by gabrieldonadel a year ago
- [go][android] Fix requestPermissions NullPointerException (#21912) # Why Closes https://github.com/expo/expo/issues/21544 # How When launching the camera through ExpoImagePicker we check for... — committed to expo/expo by gabrieldonadel a year ago
I ended up going for Flutter no regrets.
Thanks! I confirmed that new Expo Go (2.29.1) Android version has no issues about this. 😄
It just happened during my react-native class, everyone with an Android 13 had the same problem. Paradoxically we had chosen expo for the compatibility between different hardware and operating systems 😃. We hope you can solve this problem 😄
Having the same issue as everybody else. launchImageLibraryAsync works fine but launchCameraAsync does not on my physical android device running ExpoGo
Thank you for filing this issue! This comment acknowledges we believe this may be a bug and there’s enough information to investigate it. However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.
What worked for me was following these steps:
expo upgrade 47npm installthem againnpm startto install Expo Go automaticallyMany thanks to the team !
Testing with a Pixel 4 API 33 (Android 13). All seem to be working fine.
I just want to add some informations that will be useless after updating expo to version 49 (not possible yet):
If you uninstall expo go and relaunch the application, expo go will always be in version 2.28.8, the same if you install a new emulator
To update expo go on your emulator you will need to have the play store installed (emulators that have a play store icon on android studio). You need to go to playstore and update expo go.
Be careful when you have updated expo go to version 2.29.1 expo will tell you “Expo Go on xxxxx is outdated, would you like to upgrade?” (Y/n)
Enter “n” because it will downgrade expo go to version 2.28.8 otherwise
Unless someone knows an alternative way, that seems to me the easiest way to test before expo 49?
Hi @brentvatne, @gabrieldonadel (CC: @Kudo)
Sorry for pushing you about this, but I saw the upcoming SDK 49 beta release announcement in a week,
so I want to ask the followings.
It is marked as fixed by https://github.com/expo/expo/pull/21912 but I’m still facing this issue =/
sooooo?
Hi @gabrieldonadel,
I noticed that new Expo Go version (2.28.8 in GooglePlay) is released last week (4/25), but this issue is still happen and I guess that the cause is that the commit (https://github.com/expo/expo/commit/39684085747fe310d912b08767a3278ddd9e1dcd) doesn’t exist in
sdk-48branch’s commits history (https://github.com/expo/expo/commits/sdk-48).This issue started to happen since SDK48 in Android Expo Go, so I hope that the fix will be included in next Expo Go release’s SDK48 module. 🙏
Any updates?
Do we have an idea of when the next release will take place ?
I have the same issue and I need to deploy my app ASAP without downgrading the version
Thanks this solution worked for me.
I’ve seen the commit of @brentvatne being merged into the
sdk-48branch and #21912 being closed. So I’ve updated to:But the Problem still persists. Is it the app that needs an update? If so, when are you going to release one?
I’m on Expo Go: 2.28.8 without the app store showing me an update.
Jesus Christ, I have updated expo sdk from 47 to 48 to fix an issue and now I have this issue.
Both
ImagePicker.getCameraPermissionsAsyncandImagePicker.requestCameraPermissionsAsyncreturnBut when I call
ImagePicker.launchCameraAsync, I get this:My libs:
I don’t really know what to do right now, suggestions??
The new version of Expo Go has not been released yet, in the meanwhile you can use dev client
@gabrieldonadel so Expo Go 2.28.4 on emulator is working as expected. A fresh install of Expo Go on my Pixel however, is still returning the same thing and failing. Very odd.
I’ve requested some additional devices from our IT department to test on - but its looking like this might be a device specific thing.
Expo go version is 2.28.4 on a Pixel 6, running Android 13, all up to date.
Will need to double check behaviour in emulator when back at work in the morning (UK time).
Sounds like a really different problem. The application did not close, there was simply an error message:
WARN Possible Unhandled Promise Rejection (id: 0): Error: Call to function ‘ExponentImagePicker.launchCameraAsync’ has been rejected. → Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method host.exp.exponent.experience.d.checkSelfPermission
Try with another device, or another emulator.
Or check with this working example :
The error was really locate in expo go 2.28.8 and for Android 13 see here I was mentioning expo 49 compared to the version of expo go that it would provide by default in the installation (currently expo 48 installs expo go 2.28.8 on device/emulator and expo 49 will install expo go 2.29.1). So expo 49 won’t fix anything more than expo go version. Are you sure the problem is not elsewhere?
It seems that this issue only occurs with devices that already have Expo Go installed. I tried to run the app in another device and it worked with no errors.
Expo Version:
48.0.19Expo Go Version:2.28.8Thanks @gabrieldonadel !
I am having the same issues as chris-nolan. Same error. No solutions listed have fixed my issues. Anyone have any other solutions?