Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expo] fix NoSuchMethodException on getReactHost for r8 #27964

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

Kudo
Copy link
Contributor

@Kudo Kudo commented Apr 1, 2024

Why

fixes updates e2e crash on android when R8 is enabled: https://expo.dev/accounts/expo-ci/projects/updates-e2e/builds/592e06b7-b9b1-4a72-9f24-f55c9ea9d532

   @Thread DefaultDispatcher-worker-2(41):
    java.lang.NoSuchMethodException: com.facebook.react.r.getReactHost []
    	at java.lang.Class.getMethod(Class.java:2103)
    	at java.lang.Class.getDeclaredMethod(Class.java:2081)
    	at a5.g.w(SourceFile:1)
    	at a5.g.s(SourceFile:1)
    	at a5.g$a.a(SourceFile:1)
    	at a5.g$a.invoke(SourceFile:1)
    	at m7.s.getValue(SourceFile:1)
    	at a5.g.u(SourceFile:1)
    	at a5.g.t(SourceFile:1)
    	at a5.g.y(SourceFile:1)
    	at a5.g.p(SourceFile:1)
    	at a5.f.run(SourceFile:1)
    	at expo.modules.updates.UpdatesPackage$c$b.invokeSuspend(Unknown Source:12)
    	at kotlin.coroutines.jvm.internal.a.resumeWith(Unknown Source:11)
    	at la.s0.run(SourceFile:1)
    	at android.os.Handler.handleCallback(Handler.java:938)
    	at android.os.Handler.dispatchMessage(Handler.java:99)
    	at android.os.Looper.loopOnce(Looper.java:201)
    	at android.os.Looper.loop(Looper.java:288)
    	at android.app.ActivityThread.main(ActivityThread.java:7839)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    	Suppressed: la.q0: [a2{Cancelling}@94e852b, Dispatchers.IO]

How

the getReactHost is a public method and we don't keep name for public method. we could call the method directly without reflection.

Test Plan

updates e2e ci passed

Checklist

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Apr 1, 2024
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Apr 1, 2024
@expo-bot
Copy link
Collaborator

expo-bot commented Apr 1, 2024

The Pull Request introduced fingerprint changes against the base commit: 796d42a

Fingerprint diff
[
  {
    "type": "dir",
    "filePath": "../../packages/expo/android",
    "reasons": [
      "expoAutolinkingAndroid"
    ],
    "hash": "8bf80ecfa75599955d943ce3dde54bd5bc6e80aa"
  }
]

Generated by PR labeler 🤖

@Kudo Kudo marked this pull request as ready for review April 1, 2024 04:58
@Kudo Kudo removed request for brentvatne and ide April 1, 2024 04:58
@Kudo Kudo merged commit 3ca396d into main Apr 1, 2024
20 checks passed
@Kudo Kudo deleted the @kudo/fix-updates-crash-r8 branch April 1, 2024 06:02
@brentvatne brentvatne added the published Changes from the PR have been published to npm label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants