sdk:Flutter
我们在应用程序中使用Flatter和firebase消息传递。除此之外,我们还使用普通通知令牌来获取android的fcm令牌和ios的apns令牌。将gradle升级到4.2.2时出现此错误。
问题
E/AndroidRuntime(27480): at net.kikuchy.plain_notification_token.PlainNotificationTokenPlugin.onMethodCall(PlainNotificationTokenPlugin.java:47)
E/AndroidRuntime(27480): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/AndroidRuntime(27480): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/AndroidRuntime(27480): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/AndroidRuntime(27480): at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(27480): at android.os.MessageQueue.next(MessageQueue.java:335)
E/AndroidRuntime(27480): at android.os.Looper.loop(Looper.java:183)
E/AndroidRuntime(27480): at android.app.ActivityThread.main(ActivityThread.java:8010)
E/AndroidRuntime(27480): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(27480): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
E/AndroidRuntime(27480): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
E/AndroidRuntime(27480): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceId" on path: DexPathList[[zip file "/data/app/~~5gcFVfnQoOUOHN3V15pnZA==/money.bullet.internal-fy-pjwoLC9rHFRqMpeWWJw==/base.apk"],nativeLibraryDirectories=[/data/app/~~5gcFVfnQoOUOHN3V15pnZA==/money.bullet.internal-fy-pjwoLC9rHFRqMpeWWJw==/lib/arm64, /data/app/~~5gcFVfnQoOUOHN3V15pnZA==/money.bullet.internal-fy-pjwoLC9rHFRqMpeWWJw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]]
E/AndroidRuntime(27480): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
E/AndroidRuntime(27480): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(27480): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(27480): ... 11 more
I/Process (27480): Sending signal. PID: 27480 SIG: 9
Lost connection to device.
android/app/build.gradle
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.fragment:fragment:1.3.5'
implementation "com.clevertap.android:clevertap-android-sdk:4.1.1"
implementation 'com.google.android.play:core:1.10.0'
implementation 'com.google.android.gms:play-services-basement:17.6.0'
//MANDATORY for App Inbox
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
//For CleverTap Android SDK v3.6.4 and above add the following -
implementation 'com.android.installreferrer:installreferrer:2.2'
//Optional ExoPlayer Libraries for Audio/Video Inbox Messages. Audio/Video messages will be dropped without these dependencies
implementation 'com.google.android.exoplayer:exoplayer:2.14.1'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.14.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.14.1'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
// For bureau-sdk to get the advertising-id
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1'
// implementation 'com.google.firebase:firebase-iid'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'
googleServices { disableVersionCheck = true }
这是build.gradle文件,在将gradle版本从3.x更新到4.2.2之后,这个问题开始出现在Flatter项目中。我能够编译应用程序,但应用程序在运行时崩溃。
格雷德尔先生
buildscript {
ext.kotlin_version = '1.5.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
classpath 'com.google.firebase:perf-plugin:1.4.0'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
configurations.all {
resolutionStrategy {
forcedModules = [
"com.google.android.gms:play-services-vision-common:19.0.2",
]
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
1条答案
按热度按时间i2byvkas1#
添加
到你的android/app/build.gradle,这应该可以解决这个问题。