Android APP 本地调试启动时闪退

自己更换电脑时重新打包app调试,出现如下报错内容

1、报错内容

Debug service listening on ws://127.0.0.1:64487/IwaUwcYjOns=/ws
Syncing files to device COL AL10...
E/AndroidRuntime(25901): FATAL EXCEPTION: main
E/AndroidRuntime(25901): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/view/WindowInsetsControllerCompat;
E/AndroidRuntime(25901):    at io.flutter.plugin.platform.PlatformPlugin.setSystemChromeSystemUIOverlayStyle(PlatformPlugin.java:368)
E/AndroidRuntime(25901):    at io.flutter.plugin.platform.PlatformPlugin.access$700(PlatformPlugin.java:30)
E/AndroidRuntime(25901):    at io.flutter.plugin.platform.PlatformPlugin$1.setSystemUiOverlayStyle(PlatformPlugin.java:108)
E/AndroidRuntime(25901):    at io.flutter.embedding.engine.systemchannels.PlatformChannel$1.onMethodCall(PlatformChannel.java:130)
E/AndroidRuntime(25901):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/AndroidRuntime(25901):    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
E/AndroidRuntime(25901):    at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
E/AndroidRuntime(25901):    at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$R4HPk6oFVb-i-YR_PN9YE6kqx1I.run(Unknown Source:12)
E/AndroidRuntime(25901):    at android.os.Handler.handleCallback(Handler.java:907)
E/AndroidRuntime(25901):    at android.os.Handler.dispatchMessage(Handler.java:105)
E/AndroidRuntime(25901):    at android.os.Looper.loop(Looper.java:216)
E/AndroidRuntime(25901):    at android.app.ActivityThread.main(ActivityThread.java:7625)
E/AndroidRuntime(25901):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(25901):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/AndroidRuntime(25901):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
E/AndroidRuntime(25901): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.view.WindowInsetsControllerCompat" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.master-oHqYkUEF9PR1xqtJgTZGEg==/base.apk"],nativeLibraryDirectories=[/data/app/com.civiccloud.master-oHqYkUEF9PR1xqtJgTZGEg==/lib/arm64, /data/app/com.civiccloud.master-oHqYkUEF9PR1xqtJgTZGEg==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]
E/AndroidRuntime(25901):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
E/AndroidRuntime(25901):    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(25901):    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(25901):    ... 15 more
I/Process (25901): Sending signal. PID: 25901 SIG: 9
Lost connection to device.

2、依赖项

dependencies {
    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'com.android.support:multidex:1.0.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
    implementation ('com.squareup.retrofit2:converter-gson:2.1.0') {
        exclude group: 'com.google.code.gson'
    }
}

//统一androidx的各个依赖版本
configurations.all {
    resolutionStrategy {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'androidx.coordinatorlayout') {
                details.useVersion "1.0.0-rc01"
            }
            if (details.requested.group == 'androidx.core') {
                details.useVersion "1.0.0-rc01"
            }
            if (details.requested.group == 'androidx.lifecycle') {
                details.useVersion "2.0.0"
            }
            if (details.requested.group == 'androidx.versionedparcelable') {
                details.useVersion "1.0.0-rc01"
            }
            if (details.requested.group == 'androidx.fragment') {
                details.useVersion "1.0.0-rc01"
            }
            if (details.requested.group == 'androidx.appcompat') {
                details.useVersion "1.0.0-rc01"
            }
            if (details.requested.group == 'androidx.vectordrawable') {
                details.useVersion "1.0.0-rc01"
            }
            if (details.requested.group == 'androidx.media') {
                details.useVersion "1.0.0-rc01"
            }
            if (details.requested.group == 'androidx.legacy') {
                details.useVersion "1.0.0-rc01"
            }
        }
    }
}

3、解决方案 将以下部分删除即可

if (details.requested.group == 'androidx.core') {
       details.useVersion "1.0.0-rc01"
}

你可能感兴趣的:(Android APP 本地调试启动时闪退)