gpt4 book ai didi

flutter - Flutter项目中的Application.kt提供错误-无法访问 'com.google.firebase.messaging.zzf'

转载 作者:行者123 更新时间:2023-12-03 07:38:14 25 4
gpt4 key购买 nike

My application.kt文件如下:

import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService


class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
FlutterFirebaseMessagingService.setPluginRegistrant(this)
}

override fun registerWith(registry: PluginRegistry?) {
io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}

我得到的错误:
Cannot access 'com.google.firebase.messaging.zzf' which is a supertype 
of 'io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService'.
Check your module classpath for missing or conflicting dependencies
错误所在的行是 FlutterFirebaseMessagingService.setPluginRegistrant(this)
我的 android/build.gradle文件具有以下实现代码:
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

我已经尝试了很多搜索,但仍然遇到这个问题。这是怎么了?

最佳答案

尝试这个
android/build.gradle中添加classpath 'com.google.gms:google-services:4.3.3'android/app/build.gradle中添加implementation "com.google.firebase:firebase-messaging:20.1.0"
尝试这个

override fun registerWith(registry: PluginRegistry?) {
registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin");
}

关于flutter - Flutter项目中的Application.kt提供错误-无法访问 'com.google.firebase.messaging.zzf',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64550550/

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