expo: App crash when StoreReview.requestReview on android emulator

Summary

The application should not die unexpectedly when StoreReview.requestReview() on android emulator

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

40

Environment

Expo CLI 4.1.3 environment info: System: OS: macOS 11.1 Shell: 5.8 - /bin/zsh Binaries: Node: 12.20.1 - /usr/local/opt/node@12/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 6.14.10 - /usr/local/opt/node@12/bin/npm SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 IDEs: Android Studio: 3.6 AI-192.7142.36.36.6241897 Xcode: 12.4/12D4e - /usr/bin/xcodebuild npmPackages: @expo/webpack-config: ~0.12.45 => 0.12.56 expo: ^40.0.0 => 40.0.1 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: expo-cli: 4.1.3 Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

StoreReview.isAvailableAsync().then((result) => {
  if (result === true) {
    StoreReview.requestReview()
      .catch(() => {
        // silent ignore when error ???
      })
      .then(() => {
        // register review
      });
  } else {
    // not supported
  }
});

Hi guys, when I run the app in the android emulator and make the call StoreReview.requestReview() the application dies with the following log:

01-29 11:56:42.547 17475 17704 I PlayCore: UID: [10138]  PID: [17475] ReviewService : requestInAppReview (host.exp.exponent)
01-29 11:56:42.559 17475 17715 I PlayCore: UID: [10138]  PID: [17475] ReviewService : Initiate binding to the service.
01-29 11:56:42.574  1988  2740 W ActivityManager: Unable to start service Intent { act=com.google.android.finsky.BIND_IN_APP_REVIEW_SERVICE pkg=com.android.vending } U=0: not found
01-29 11:56:42.582 17475 17715 I PlayCore: UID: [10138]  PID: [17475] ReviewService : Failed to bind to the service.
01-29 11:56:42.588 17475 17475 D AndroidRuntime: Shutting down VM
01-29 11:56:42.590 17475 17475 E AndroidRuntime: FATAL EXCEPTION: main
01-29 11:56:42.590 17475 17475 E AndroidRuntime: Process: host.exp.exponent, PID: 17475
01-29 11:56:42.590 17475 17475 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Throwable.getMessage()' on a null object reference
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at abi40_0_0.org.unimodules.core.a.$default$reject(Promise.java:6)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at abi40_0_0.org.unimodules.adapters.react.PromiseWrapper.reject(Unknown Source:0)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at abi40_0_0.org.unimodules.core.a.$default$reject(Promise.java:4)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at abi40_0_0.org.unimodules.adapters.react.PromiseWrapper.reject(Unknown Source:0)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at abi40_0_0.expo.modules.storereview.StoreReviewModule$requestReview$1.onComplete(StoreReviewModule.kt:5)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at d.g.b.h.a.f.h.run(Unknown Source:23)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:883)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:100)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7356)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
01-29 11:56:42.590 17475 17475 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

The emulator does not have the play services installed, so it seems that it cannot start the intent com.google.android.finsky.BIND_IN_APP_REVIEW_SERVICE.

I think the call to StoreReview.isAvailableAsync() should handle this to prevent the application from dying unexpectedly.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 10
  • Comments: 28 (16 by maintainers)

Most upvoted comments

It crashed for me with Android emulator and nothing happened with real device (Pixel 2).

It’s a project with Expo managed workflow.

Bump. This is still an issue.

I can confirm that this is happening. Just encountered the same issue.

it’s expected for this not to work in the android emulator if you don’t have google play installed, but i agree with op @outaTiME that crashing isn’t the best result here. this feature was originally added via a pr, perhaps someone could follow up with an improvement pr?

I did some investigation on the StoreReview Module and opened an Issue: #16363

that looks like a different error entirely. it seems like mActivityProvider.currentActivity is null on https://github.com/expo/expo/blob/3c0694c173bd738a3384a10c22e589f5be247224/packages/expo-store-review/android/src/main/java/expo/modules/storereview/StoreReviewModule.kt#L47 and this error occurs not on launching the store review flow but after completion

this comes from https://github.com/expo/expo/blob/3c0694c173bd738a3384a10c22e589f5be247224/packages/%40unimodules/react-native-adapter/android/src/main/java/org/unimodules/adapters/react/services/UIManagerModuleWrapper.java#L191-L194

maybe the activity was killed due to memory pressure. hard to say exactly, but the code corresponding to this doesn’t actually live in expo-store-review, we just assume that react-native is able to give us the current activity

I had an instance of this crash in production, with seemingly a similar stacktrace. So I agree with others here, isAvailableAsync should be reliable!

Hi guys, as I say in the issue report it only happens in android emulator.