启动应用程序时React NativeAndroid错误

jogvjijk  于 2022-11-17  发布在  React
关注(0)|答案(1)|浏览(237)
V/SoLoader: libimagepipeline.so not found on /data/data/com.learnapp/lib-main
D/SoLoader: libimagepipeline.so found on /data/app/com.learnapp-liVxYGD3IHkNE51rFYNd0g==/lib/x86
    Not resolving dependencies for libimagepipeline.so
D/EGL_emulation: eglMakeCurrent: 0xa9905ea0: ver 3 0 (tinfo 0xa99037b0)
I/zygote: Background concurrent copying GC freed 59540(4MB) AllocSpace objects, 3(68KB) LOS objects, 49% free, 3MB/7MB, paused 1.490ms total 153.153ms
D/AndroidRuntime: Shutting down VM

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.learnapp, PID: 7966
    java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.facebook.react.common.SurfaceDelegate.isShowing()' on a null object reference
        at com.facebook.react.devsupport.DevSupportManagerBase$5.run(DevSupportManagerBase.java:301)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

得到这个问题,而启动React原生应用程序的android模拟器。它的工作正常的ios虽然。

swvgeqrz

swvgeqrz1#

将其添加到android/buld.gradle文件的allprojects区域中。

def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) allprojects {
    configurations.all {
        resolutionStrategy {
            // Remove this override in 0.65+, as a proper fix is included in react-native itself.
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }
}

rn问题:https://github.com/facebook/react-native/issues/35210

相关问题