java.lang.RuntimeException:请求启用 DevSupportManager,但找不到或无法创建 DevSupportManagerImpl 类

2022-09-03 00:09:39

在 React-Native 中创建应用程序后,我将第三方组件导入 Android。在集成了这个组件之后,该组件适用于Android应用程序,在React-Native中的应用程序上,它给我带来了这个错误:

2020-03-30 10:07:49.005 13979-13979/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.smartsign, PID: 13979
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.smartsign/com.smartsign.MainActivity}: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created
        ...
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.devsupport.DevSupportManagerImpl" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.smartsign-LPgTscLKBMEXk1VohB6_Lw==/base.apk"],nativeLibraryDirectories=[/data/app/com.smartsign-LPgTscLKBMEXk1VohB6_Lw==/lib/x86, /data/app/com.smartsign-LPgTscLKBMEXk1VohB6_Lw==/base.apk!/lib/x86, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at java.lang.Class.classForName(Native Method) 
        at java.lang.Class.forName(Class.java:453) 
        at java.lang.Class.forName(Class.java:378) 
        at com.facebook.react.devsupport.DevSupportManagerFactory.create(DevSupportManagerFactory.java:67) 
        at com.facebook.react.ReactInstanceManager.<init>(ReactInstanceManager.java:231) 
        at com.facebook.react.ReactInstanceManagerBuilder.build(ReactInstanceManagerBuilder.java:275) 
        at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:86) 
        at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:38) 
        at com.facebook.react.ReactDelegate.loadApp(ReactDelegate.java:103) 
        at com.facebook.react.ReactActivityDelegate.loadApp(ReactActivityDelegate.java:88) 
        at com.facebook.react.ReactActivityDelegate.onCreate(ReactActivityDelegate.java:83) 
        at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:44) 
        at android.app.Activity.performCreate(Activity.java:7136) 
        at android.app.Activity.performCreate(Activity.java:7127) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

如何解决它以启动现在打开时崩溃的应用程序?


答案 1

这样做将解决app/build.gradle中的问题

implementation 'com.squareup.okhttp3:okhttp:4.9.0' 

答案 2

在应用的 build.gradle 中添加以下内容:

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
    exclude group:'com.squareup.okhttp3', module:'okhttp'
}