gpt4 book ai didi

flutter - 未解析的引用 : firebasemessaging

转载 作者:行者123 更新时间:2023-12-04 16:37:47 26 4
gpt4 key购买 nike

收到此错误我已尝试修复此引用:Application.kt: Unresolved reference: firebasemessaging但没有工作,所以我需要再次发布我也尝试删除 application.kt 文件但没有工作。如果有人知道解决方案,请让我知道我做错了什么,这样我就可以学会不再重复这些

 ext.kotlin_version = '1.4.32'
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}




package com.godatu.dance

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

class Application : FlutterApplication(), PluginRegistry.PluginRegistrantCallback {

override fun onCreate() {
super.onCreate()
FlutterFirebaseMessagingService.setPluginRegistrant(this)
}

override fun registerWith(registry: PluginRegistry?) {
if (registry != null) {
FirebaseCloudMessagingPluginRegistrant.registerWith(registry)
FlutterLocalNotificationPluginRegistrant.registerWith(registry)
FlutterPathProviderPluginRegistrant.registerWith(registry)
}
}

}


enter code here
[ +2 ms] e: C:\Users\Admin\Desktop\Android\godatu-App\android\app\src\main\kotlin\com\godatu\dance\Application.kt: (6, 27): Unresolved reference: firebasemessaging
[ +3 ms] e: C:\Users\Admin\Desktop\Android\godatu-App\android\app\src\main\kotlin\com\godatu\dance\Application.kt: (7, 27): Unresolved reference: firebasemessaging
[ ] e: C:\Users\Admin\Desktop\Android\godatu-App\android\app\src\main\kotlin\com\godatu\dance\Application.kt: (12, 9): Unresolved reference: FlutterFirebaseMessagingService
[ ] e: C:\Users\Admin\Desktop\Android\godatu-App\android\app\src\main\kotlin\com\godatu\dance\Application.kt: (20, 7): Redeclaration: FirebaseCloudMessagingPluginRegistrant
[ ] e: C:\Users\Admin\Desktop\Android\godatu-App\android\app\src\main\kotlin\com\godatu\dance\Application.kt: (26, 13): Unresolved reference: FirebaseMessagingPlugin
[ ] e: C:\Users\Admin\Desktop\Android\godatu-App\android\app\src\main\kotlin\com\godatu\dance\FirebaseCloudMessagingPluginRegistrant.kt: (5, 27): Unresolved reference: firebasemessaging
[ ] e: C:\Users\Admin\Desktop\Android\godatu-App\android\app\src\main\kotlin\com\godatu\dance\FirebaseCloudMessagingPluginRegistrant.kt: (8, 7): Redeclaration: FirebaseCloudMessagingPluginRegistrant
[ ] e: C:\Users\Admin\Desktop\Android\godatu-App\android\app\src\main\kotlin\com\godatu\dance\FirebaseCloudMessagingPluginRegistrant.kt: (17, 17): Unresolved reference: FirebaseMessagingPlugin
[ +84 ms] FAILURE: Build failed with an exception.
[ ] * What went wrong:
[ ] Execution failed for task ':app:compileDebugKotlin'.
[ ] > Compilation error. See log for more details
[ ] * Try:
[ ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[ ] * Get more help at https://help.gradle.org
[ ] BUILD FAILED in 27s
[ ] 399 actionable tasks: 5 executed, 394 up-to-date
[{"event":"app.progress","params":{"appId":"82f5465d-087d-4b13-8c4a-7ae1698e399b","id":"0","progressId":null,"finished":true}}]
[+5408 ms] Exception: Gradle task assembleDebug failed with exit code 1
[ +4 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:550:9)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12)
<asynchronous suspension>
#3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1009:27)
<asynchronous suspension>
#4 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#5 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#6 CommandRunner.runCommand (package:args/command_runner.dart:197:13)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:278:9)
<asynchronous suspension>
#8 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#9 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#10 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5)
<asynchronous suspension>
#11 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#12 run.<anonymous closure> (package:flutter_tools/runner.dart:62:12)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#14 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)
<asynchronous suspension>
#15 runInContext (package:flutter_tools/src/context_runner.dart:73:10)
<asynchronous suspension>
#16 main (package:flutter_tools/executable.dart:90:3)
<asynchronous suspension>


[{"event":"app.stop","params":{"appId":"82f5465d-087d-4b13-8c4a-7ae1698e399b"}}]
[ +18 ms] "flutter run" took 36,338ms.
[{"id":0,"error":"app '82f5465d-087d-4b13-8c4a-7ae1698e399b' not found","trace":"#0 AppDomain.stop (package:flutter_tools/src/commands/daemon.dart:698:7)\n#1 Domain.handleCommand.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:217:34)\n#2 new Future.sync (dart:async/future.dart:218:31)\n#3 Domain.handleCommand (package:flutter_tools/src/commands/daemon.dart:215:5)\n#4 Daemon._handleRequest (package:flutter_tools/src/commands/daemon.dart:141:28)\n#5 _rootRunUnary (dart:async/zone.dart:1362:47)\n#6 _CustomZone.runUnary (dart:async/zone.dart:1265:19)\n#7 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)\n#8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)\n#9 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)\n#10 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)\n#11 _MapStream._handleData (dart:async/stream_pipe.dart:218:10)\n#12 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)\n#13 _rootRunUnary (dart:async/zone.dart:1362:47)\n#14 _CustomZone.runUnary (dart:async/zone.dart:1265:19)\n#15 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)\n#16 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)\n#17 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)\n#18 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)\n#19 _WhereStream._handleData (dart:async/stream_pipe.dart:195:12)\n#20 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)\n#21 _rootRunUnary (dart:async/zone.dart:1362:47)\n#22 _CustomZone.runUnary (dart:async/zone.dart:1265:19)\n#23 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)\n#24 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)\n#25 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)\n#26 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)\n#27 _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)\n#28 _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)\n#29 _LineSplitterSink._addLines (dart:convert/line_splitter.dart:155:13)\n#30 _LineSplitterSink.addSlice (dart:convert/line_splitter.dart:130:5)\n#31 StringConversionSinkMixin.add (dart:convert/string_conversion.dart:163:5)\n#32 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)\n#33 _rootRunUnary (dart:async/zone.dart:1362:47)\n#34 _CustomZone.runUnary (dart:async/zone.dart:1265:19)\n#35 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)\n#36 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)\n#37 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)\n#38 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)\n#39 _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)\n#40 _StringAdapterSink.add (dart:convert/string_conversion.dart:238:11)\n#41 _StringAdapterSink.addSlice (dart:convert/string_conversion.dart:243:7)\n#42 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:317:20)\n#43 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:310:5)\n#44 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18)\n#45 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)\n#46 _rootRunUnary (dart:async/zone.dart:1362:47)\n#47 _CustomZone.runUnary (dart:async/zone.dart:1265:19)\n#48 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)\n#49 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)\n#50 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)\n#51 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)\n#52 _StreamController._add (dart:async/stream_controller.dart:607:7)\n#53 _StreamController.add (dart:async/stream_controller.dart:554:5)\n#54 _Socket._onData (dart:io-patch/socket_patch.dart:2144:41)\n#55 _rootRunUnary (dart:async/zone.dart:1370:13)\n#56 _CustomZone.runUnary (dart:async/zone.dart:1265:19)\n#57 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)\n#58 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)\n#59 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)\n#60 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)\n#61 _StreamController._add (dart:async/stream_controller.dart:607:7)\n#62 _StreamController.add (dart:async/stream_controller.dart:554:5)\n#63 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1680:33)\n#64 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1192:14)\n#65 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)\n#66 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)\n#67 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:120:13)\n#68 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:185:5)\n"}]

最佳答案

您不需要在 flutter v2 中照顾注册人。它会自己自动处理。因此您不需要包含 Application 类。

关于flutter - 未解析的引用 : firebasemessaging,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67126413/

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