gpt4 book ai didi

android - Flutter:失去与设备的连接(生产应用程序)

转载 作者:行者123 更新时间:2023-12-03 16:13:19 30 4
gpt4 key购买 nike

在 Debug模式和上传到 Play 商店的应用程序中,当我第一次打开应用程序时,它会崩溃。虽然如果我再次打开它,那么一切正常。

I/zygote64(11974): Rejecting re-init on previously-failed class java.lang.Class<com.google.firebase.messaging.FirebaseMessagingService>: java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/com.ved.mentor101app-AbvtNHTF_HGKeS2lffOLiw==/base.apk!classes3.dex)
Lost connection to device.

D/AndroidRuntime(11974): Shutting down VM
E/AndroidRuntime(11974): FATAL EXCEPTION: main
E/AndroidRuntime(11974): Process: com.ved.mentor101app, PID: 11974
E/AndroidRuntime(11974): java.lang.RuntimeException: Unable to instantiate service io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: java.lang.ClassNotFoundException: Didn't find class "io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService" on path: DexPathList[[zip file "/data/app/com.ved.mentor101app-AbvtNHTF_HGKeS2lffOLiw==/base.apk"],nativeLibraryDirectories=[/data/app/com.ved.mentor101app-AbvtNHTF_HGKeS2lffOLiw==/lib/arm64, /data/app/com.ved.mentor101app-AbvtNHTF_HGKeS2lffOLiw==/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]

E/AndroidRuntime(11974): Caused by: java.lang.IllegalAccessError: Class com.google.firebase.iid.zzb extended by class com.google.firebase.messaging.FirebaseMessagingService is inaccessible (declaration of 'com.google.firebase.messaging.FirebaseMessagingService' appears in /data/app/com.ved.mentor101app-AbvtNHTF_HGKeS2lffOLiw==/base.apk!classes3.dex)
E/AndroidRuntime(11974): ... 13 more
I/zygote64(11974): Do partial code cache collection, code=61KB, data=44KB
I/zygote64(11974): After code cache collection, code=61KB, data=44KB
I/zygote64(11974): Increasing code cache capacity to 256KB
I/Process (11974): Sending signal. PID: 11974 SIG: 9er

完整的调试语句(不能在文本中上传,因为 StackOverflow 不允许它的长度):
1/3 2/3 3/3
// flutter doctor -v:
flutter doctor -v
[√] Flutter (Channel stable, v1.2.2-pre.1, on Microsoft Windows [Version 10.0.15063], locale en-US)
• Flutter version 1.2.2-pre.1 at C:\Users\Dell\flutter
• Framework revision 03b53e0901 (7 weeks ago), 2019-04-20 19:15:26 +0530
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\Dell\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.

[√] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 33.4.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] VS Code (version 1.34.0)
• VS Code at C:\Users\Dell\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.1.0

[√] Connected device (1 available)
• RMX1801 • 8843cc23 • android-arm64 • Android 8.1.0 (API 27)

• No issues found!


[1]: /image/ZcIaC.png
[2]: /image/NzpLH.png
[3]: /image/EnqNV.png

最佳答案

最终有帮助的是:
在应用级别 build.gradle

 defaultConfig {      

minSdkVersion 23

}
在项目级别 gradle.properties添加
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
build.gradle添加
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}

Your gradle version should be greater than 5


如果您不使用 Kotlin 支持,则可以跳过该 Kotlin 插件
不要忘记运行 flutter clean然后 flutter pub upgrade这些更改帮助我防止了我的应用程序崩溃,它也应该对您有所帮助。

关于android - Flutter:失去与设备的连接(生产应用程序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56479669/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com