expo: Error: The method or property expo-random.getRandomBytes is not available on android, are you sure you've linked all the native dependencies properly?

Summary

Expected behavior I expect the button to sign-in using Google SSO to appear on Android (seems to work fine on iOS)

Actual behavior The app throws an error saying: Error: The method or property expo-random.getRandomBytes is not available on android, are you sure you've linked all the native dependencies properly?

image

What platform(s) does this occur on?

Android

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 12.4 Shell: 5.8 - /usr/local/bin/zsh Binaries: Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 IDEs: Android Studio: 4.2 AI-202.7660.26.42.7351085 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild npmPackages: babel-preset-expo: ~9.2.0 => 9.2.0 expo: ^46.0.0 => 46.0.10 react: 18.0.0 => 18.0.0 react-native: 0.69.5 => 0.69.5 npmGlobalPackages: eas-cli: 0.57.0 expo-cli: 6.0.1 Expo Workflow: managed

Minimal reproducible example

We’ve reproduced the error on this repo

After building the app (yarn build:android:device), you can download the build, and as soon as you launch the app in the dev client, it crashes with the error

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 9
  • Comments: 39 (9 by maintainers)

Commits related to this issue

Most upvoted comments

+1 also with facebook login (expo auth session) only when reload the app with expo updates

My issue was resolved after downgrading “react-native-get-random-values” to “1.8.0”.

Hey! I’m using expo@47.0.6 and expo-auth-session@4.0.3 and I’m still having this issue… Was this fix removed or forgotten since the last release? @Kudo

It’s fixed on ~expo-crypto@12.2.2~ expo-crypto@12.4.0

sorry for late publishing the fix, please install expo@46.0.17 to get the updates. if still encountered problems, please let us know. thanks!

@maxenceg we would like to publish patch release with the other fix together, and it should be available within this week.

I don’t really know how to reproduce the issue since the only thing I had was that crash, after following your steps. And indeed, since there were no logs we might think it was not related to the initial expo-random bug, but again, every time I removed the code related to expo-auth-session, the app would stop crashing after some reloads.

If I find a way to reproduce the bug, I’ll keep you posted!

Hi @Kudo!

I just tried to apply your patch and can confirm that it works 🚀🚀🚀

Thanks a lot for all the time and effort you’ve put into this issue, it means a lot to us!

I think I just installed expo-random as my own dependency and it fixed the issue.

On Fri, Sep 30, 2022, 11:42 AM Mateusz Rostkowski @.***> wrote:

I have this issue in managed workflow, I think I can’t update expo to 46.0.7 or higher, do you guys know about some workaround for that?

— Reply to this email directly, view it on GitHub https://github.com/expo/expo/issues/19167#issuecomment-1263733107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGPNFUN3LTPRUWHAJJ5GSDWA4C63ANCNFSM6AAAAAAQQANG7E . You are receiving this because you commented.Message ID: @.***>

Thanks @RohovDmytro, downgrading "react-native-get-random-values": "1.8.0" did the trick.

Yes, I kept your changes + installed hermes this morning and still get the crash after multiple reloads (which I still don’t get when I remove the button and the expo-auth-session-related code)