question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Encountered an exception while calling native method... method askAsync on module ExpoPermissions

See original GitHub issue

🐛 Bug Report

Encountered an exception while calling native method: Exception occurred while executing exported method askAsync on module ExpoPermissions: String resource ID #0xffffffff
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:103:50 in promiseMethodWrapper
- node_modules/@unimodules/react-native-adapter/build/NativeModulesProxy.native.js:15:23 in moduleName.methodInfo.name
- node_modules/expo-permissions/build/Permissions.js:80:0 in _handlePermissionsRequestAsync

This error occurred on an Android 10 emulator, but I’ve received reports of issues related to this from many Android users on multiple devices. I’m still working on collecting information.

Related: #5548, #8910

Steps to Reproduce

When asking for location permission, I initially denied the request. In system settings, I allowed location services and returned to the app. Each time thereafter, this error occurred when Permissions.askAsync(Permissions.LOCATION) was called. canAskAgain is true.

It does not seem to occur when permissions are allowed on the first request.

Reproducible Demo

  1. Deny location permissions when asked.
  2. Go to settings, enabled location permissions.
  3. const response = await Permissions.askAsync(Permissions.LOCATION);

Environment - output of expo diagnostics & the platform(s) you’re targeting

Android 10

Expo CLI 3.27.6 environment info:
    System:
      OS: macOS 10.15.5
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.18.2 - /usr/local/bin/node
      npm: 6.14.5 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.8.4 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    IDEs:
      Android Studio: 4.0 AI-193.6911.18.40.6626763
      Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~38.0.8 => 38.0.8 
      react: ~16.11.0 => 16.11.0 
      react-dom: ~16.11.0 => 16.11.0 
      react-native: https://github.com/expo/react-native/archive/sdk-38.0.1.tar.gz => 0.62.2 
      react-native-web: ~0.11.7 => 0.11.7 
    npmGlobalPackages:
      expo-cli: 3.27.6
    Expo Workflow: managed

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
torreyleonardcommented, Oct 2, 2020

I was able to find a workaround by replacing Permissions.askAsync(Permissions.LOCATION) with Location.requestPermissionsAsync() from expo-location.

However, Permissions.getAsync(Permissions.LOCATION) returns a “denied” response after expo-location returns as “granted.” I had to replace every call to location permissions with the methods provided in expo-location, otherwise the responses are inconsistent.

This still only occurs on Android.

1reaction
byCedriccommented, Oct 5, 2020

Hi @torreyleonard! Thanks for the detailed issue report, I could reproduce the issue with the steps you mentioned. This is an issue in the Expo Client on Android, but this shouldn’t be an issue with your standalone build. I also created a fix for this, let’s hope we can release this asap! 😄

Again, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception occurred while executing exported method ...
[Error: Encountered an exception while calling native method: Exception occurred while executing exported method askAsync on module ...
Read more >
How to use the expo-permissions.askAsync function in ... - Snyk
To help you get started, we've selected a few expo-permissions.askAsync examples, based on popular ways it is used in public projects.
Read more >
react-native-permissions - npm
Start using react-native-permissions in your project by running `npm ... As permissions are not handled in the same way on iOS and Android, ......
Read more >
Expo Android Native Module 实现分析 - 开发者头条
本文介绍了Expo在Native Module上的具体实现及其架构思路。 ... askAsync(Permissions. ... "Encountered an exception while calling native method: " + e.
Read more >
null is not an object (evaluating 'rnfsmanager.rnfsfiletyperegular')
In case of iOS message is 'Native module cannot be null', In Android message is ... Solution for iOS is run pod install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found