java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created

回答 4 浏览 9828 2020-03-30

在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) 

如何才能解决启动现在打开时崩溃的应用程序呢?

TheSnake 提问于2020-03-30
尝试清理项目并重新运行应用程序。如果这不起作用,请添加你所做的修改,以添加那个新的库组件。user11587840 2020-03-30
@Parthshrivastav 我已经在这个评论下用我改变的代码做了一个新的答案。TheSnake 2020-03-30
4 个回答
#1楼
得票数 20

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

implementation 'com.squareup.okhttp3:okhttp:4.9.0' 
Usama Shahid 提问于2021-09-06
这对我很有用!非常感谢!gwl002 2022-01-06
这个解决方案对我有用。可能是一个被接受的答案。ThinkAndCode 2022-10-12
#2楼
得票数 15

在你的应用程序的build.gradle中添加此内容。

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
    exclude group:'com.squareup.okhttp3', module:'okhttp'
}
Virluz 提问于2021-08-12
enzo 修改于2021-08-13
我已经有这个问题了,但对我来说,它仍然崩溃。我升级了min和target sdk版本,但还是崩溃。Abdul Sadik Yalcin 2021-10-08
#3楼
得票数 0

清理并重新运行这不起作用。 这是我为添加组件而更改的代码。 顶级 build.gradlerepositories

jcenter()
mavenCentral()
maven { url 'https://haibison.bitbucket.io/maven-repos' }
maven { url 'https://mvnrepository.com/artifact/com.google.zxing' }
maven { url 'https://mvnrepository.com/artifact/org.jdom/jdom2' }
maven { url 'https://mvnrepository.com/artifact/jaxen/jaxen' }
maven { url 'https://mvnrepository.com/artifact/com.madgag.spongycastle/pkix' }
maven { url 'https://mvnrepository.com/artifact/org.onepf/openiab' }
maven { url 'https://mvnrepository.com/artifact/com.drewnoakes/metadata-extractor' }
maven { url 'https://mvnrepository.com/artifact/org.apache.commons/commons-lang3' }
maven { url 'http://repo.jenkins-ci.org/releases' }
maven { url 'https://maven.google.com' } //Gradle 3.x tools need to be retrieved from here as well
flatDir {
        dirs '../aar'
}

应用级 build.gradledefaultConfig 块下

multiDexEnabled true

App-level build.gradlebuildTypesdebug 块下 阻止

debuggable true
minifyEnabled true
proguardFiles '../proguard_dexguard_configs/proguard-android.txt', '../proguard_dexguard_configs/proguard-project.txt'

App 级 build.gradlebuildTypesrelease 块下 阻止

minifyEnabled true
shrinkResources true
proguardFiles '../proguard_dexguard_configs/proguard-android.txt', '../proguard_dexguard_configs/proguard-project.txt'

应用级 build.gradledependencies 块下

ext.androidx_annotation = '1.1.0'
ext.androidx_appcompat = '1.1.0'
ext.androidx_cardview = '1.0.0'
ext.androidx_core = '1.1.0'
ext.androidx_fragment = '1.1.0'
ext.androidx_gridlayout = '1.0.0'
ext.androidx_legacy = '1.0.0'
ext.androidx_media = '1.1.0'
ext.androidx_preference = '1.1.0'
ext.androidx_recyclerview = '1.0.0'

ext.qr_libs_version = "3.3.0" 
ext.lockpattern_version = "10.0.0" 
ext.jdom_version = "2.0.6" 
ext.jaxen_version = "1.1.6" 
ext.spongy_version = "1.54.0.0" 
ext.openiab_version = "0.9.8.7" 
ext.metadataextractor_version = "2.9.1" 
ext.jcifs_version = "1.3.18-kohsuke-1" 
ext.commonslang_version = "3.5" 
ext.aboutlibraries_libs_version = "6.2.3" 

dependencies {
    api 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    api 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    api (name:'SIGNificant4AndroidSDK', ext:'aar')
    api "haibison.android:lockpattern:$lockpattern_version" 
    api "androidx.annotation:annotation:$androidx_annotation" 
    api "androidx.core:core:$androidx_core" 
    api "androidx.legacy:legacy-support-core-utils:$androidx_legacy" 
    api "androidx.legacy:legacy-support-core-ui:$androidx_legacy" 
    api "androidx.media:media:$androidx_media" 
    api "androidx.fragment:fragment:$androidx_fragment" 
    api "androidx.appcompat:appcompat:$androidx_appcompat" 
    api "androidx.gridlayout:gridlayout:$androidx_gridlayout" 
    api "androidx.preference:preference:$androidx_preference" 
    api "androidx.recyclerview:recyclerview:$androidx_recyclerview" 
    api "androidx.cardview:cardview:$androidx_cardview" 
    api (name:'Sources_Custom_Support_Library_v4', ext:'aar')
    api (name:'SIGNificant4AndroidSDK_JniBitmapOperationsLibrary', ext:'aar')
    api (name:'SIGNificant4AndroidSDK_QRCodeScanner', ext:'aar')
    api ("com.google.zxing:core:$qr_libs_version")
    api ("com.google.zxing:android-core:$qr_libs_version")
    api ("com.google.zxing:android-integration:$qr_libs_version")
    api ("org.jdom:jdom2:$jdom_version") {transitive = true;}
    api ("jaxen:jaxen:$jaxen_version") {transitive = true;}
    api ("com.madgag.spongycastle:pkix:$spongy_version") {transitive = true;}
    api ("org.onepf:openiab:$openiab_version")
    api ("com.drewnoakes:metadata-extractor:$metadataextractor_version") {transitive = true;}
    api ("org.samba.jcifs:jcifs:$jcifs_version") {transitive = true;}
    api("com.mikepenz:aboutlibraries:$aboutlibraries_libs_version") { transitive = true; }
    api ("org.apache.commons:commons-lang3:$commonslang_version")
}

并在AndroidManifest.xml中放入标签

<activity
            android:name="com.xyzmo.ui.DocumentImage" 
            android:alwaysRetainTaskState="true" 
            android:label="@string/significant_app_name" 
            android:launchMode="singleTask" 
            android:windowSoftInputMode="adjustResize" />
        <activity
            android:name="com.xyzmo.ui.CaptureSignature" 
            android:label="@string/significant_app_name" 
            android:windowSoftInputMode="adjustResize" />
        <activity
            android:name="com.xyzmo.ui.AndroidExplorer" 
            android:label="@string/explorer" 
            android:windowSoftInputMode="adjustResize" />
        <activity
            android:name="com.xyzmo.ui.MainSettingsActivity" 
            android:label="@string/title_activity_main_settings" 
            android:logo="@mipmap/icon">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY" 
                android:value="com.xyzmo.ui.DocumentImage" />
        </activity>

        <activity
            android:name="com.xyzmo.ui.SIGNificantLockpatternActivity" 
            android:theme="@style/Significant.Lockpattern.Theme" 
            tools:replace="android:theme" 
            android:label="@string/xyzmo_lockpattern_titlebar" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY" 
                android:value="com.xyzmo.ui.DocumentImage" />
        </activity>

        <activity
            android:name="com.xyzmo.kiosk.ui.AdvertisementActivity" 
            android:theme="@android:style/Theme.Holo.Dialog"></activity>

        <activity
        android:name="com.xyzmo.ui.AboutActivity" 
        android:theme="@style/SIGNificant_AboutTheme"></activity>
TheSnake 提问于2020-03-30
该死的,那么多的依赖性:OE J Chathuranga 2020-04-23
#4楼
得票数 0

我的情况是,我使用的安卓模拟器是建立在SDK API 16上的。创建比SDK 16更高的新模拟器的工作就像一个魅力。

E J Chathuranga 提问于2020-04-23