**问题:**构建React Native项目的Android APK,其中包含react-native-分支版本5.4.0的包会导致应用崩溃。
Logcat:
2023-08-02 09:13:14.958 21590-21590/staging.klubcoin E/AndroidRuntime: FATAL EXCEPTION: main
Process: staging.klubcoin, PID: 21590
java.lang.NoSuchMethodError: No static method getInstance(Landroid/content/Context;)Lio/branch/referral/Branch; in class Lio/branch/referral/Branch; or its super classes (declaration of 'io.branch.referral.Branch' appears in /data/app/~~I5cmDpCmKQePbQPBCrzxzA==/staging.klubcoin-GsaHiZyd32cGjYRnZFrsYA==/base.apk!classes7.dex)
at io.branch.rnbranch.RNBranchModule.setupBranch(RNBranchModule.java:746)
at io.branch.rnbranch.RNBranchModule.initSession(RNBranchModule.java:123)
at com.liquichain.MainActivity.onStart(MainActivity.java:37)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1436)
at android.app.Activity.performStart(Activity.java:8024)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3459)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2068)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7703)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
字符串
1条答案
按热度按时间f87krz0w1#
**解决方案:**将react-native-分支升级到5.9.0版本即可解决问题