achorein/expo-share-intent

Crash on android device

hir0r0 opened this issue · 4 comments

Describe the bug
When I tried to launch the app on an Android device using example/basic, the app crashed.
It works fine on Android simulator.

An error message was printed on the console.

java.lang.RuntimeException: Unable to resume activity {expo.modules.exposhareintent.example/expo.modules.exposhareintent.example.MainActivity}: java.lang.NullPointerException
  android.app.ActivityThread.performResumeActivity(ActivityThread.java:4773)
  android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4806)
  android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
  android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
  android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
  android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
  android.os.Handler.dispatchMessage(Handler.java:106)
  android.os.Looper.loopOnce(Looper.java:201)
  android.os.Looper.loop(Looper.java:288)
  android.app.ActivityThread.main(ActivityThread.java:7872)
  java.lang.reflect.Method.invoke(Native Method)
  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by java.lang.NullPointerException
  expo.modules.shareintent.ExpoShareIntentModule$Companion.getFileInfo(ExpoShareIntentModule.kt:59)
  expo.modules.shareintent.ExpoShareIntentModule$Companion.handleShareIntent(ExpoShareIntentModule.kt:113)
  expo.modules.shareintent.ExpoShareIntentModule$definition$lambda$6$$inlined$OnNewIntent$1.invoke(ModuleDefinitionBuilder.kt:144)
  expo.modules.shareintent.ExpoShareIntentModule$definition$lambda$6$$inlined$OnNewIntent$1.invoke(ModuleDefinitionBuilder.kt:117)
  expo.modules.kotlin.events.EventListenerWithPayload.call(EventListener.kt:25)
  expo.modules.kotlin.ModuleHolder.post(ModuleHolder.kt:99)
  expo.modules.kotlin.ModuleRegistry.post(ModuleRegistry.kt:90)
  expo.modules.kotlin.AppContext.onNewIntent$expo_modules_core_debug(AppContext.kt:360)
  expo.modules.kotlin.ReactLifecycleDelegate.onNewIntent(ReactLifecycleDelegate.kt:37)
  com.facebook.react.bridge.ReactContext.onNewIntent(ReactContext.java:322)
  com.facebook.react.ReactInstanceManager.onNewIntent(ReactInstanceManager.java:535)
  com.facebook.react.ReactActivityDelegate.onNewIntent(ReactActivityDelegate.java:183)
  expo.modules.ReactActivityDelegateWrapper.onNewIntent(ReactActivityDelegateWrapper.kt:254)
  com.facebook.react.ReactActivity.onNewIntent(ReactActivity.java:102)
  android.app.Activity.performNewIntent(Activity.java:8321)
  android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1517)
  android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1530)
  android.app.ActivityThread.deliverNewIntents(ActivityThread.java:3822)
  android.app.ActivityThread.performResumeActivity(ActivityThread.java:4756)
  android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4806)
  android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
  android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
  android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
  android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
  android.os.Handler.dispatchMessage(Handler.java:106)
  android.os.Looper.loopOnce(Looper.java:201)
  android.os.Looper.loop(Looper.java:288)
  android.app.ActivityThread.main(ActivityThread.java:7872)
  java.lang.reflect.Method.invoke(Native Method)
  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
  com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

To Reproduce
Switch to expo50 branch and Run yarn android in example/basic

Environment

info Fetching system and libraries information...
System:
  OS: macOS 14.3
  CPU: (11) arm64 Apple M3 Pro
  Memory: 144.30 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.12.0
    path: ~/.nvm/versions/node/v20.12.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v20.12.0/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v20.12.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/devel/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10227.8.2321.11479570
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 3.2.1
    path: /Users/devel/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false