My project cannot be built or runned anymore since I updated to firebase_messaging: 6.0.7.
Error log:
flutter run --verbose
...
error: cannot access FirebaseMessagingService
[ ] FlutterFirebaseMessagingService.setPluginRegistrant(this);
[ ] ^
[ ] class file for com.google.firebase.messaging.FirebaseMessagingService not found
[ ] 1 error
[ ] FAILURE: Build failed with an exception.
[ ] * What went wrong:
[ ] Execution failed for task ':app:compileDebugJavaWithJavac'.
[ ] > Compilation failed; see the compiler error output for 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 10s
[ +369 ms] Running Gradle task 'assembleDebug'... (completed in 11,5s)
[ +5 ms] "flutter run" took 13.543ms.
Gradle task assembleDebug failed with exit code 1
#0 throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1 buildGradleApp (package:flutter_tools/src/android/gradle.dart:387:7)
#2 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#3 _rootRunUnary (dart:async/zone.dart:1134:38)
#4 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#5 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#6 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#7 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#8 Future._completeWithValue (dart:async/future_impl.dart:524:5)
#9 _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:32:15)
#10 _completeOnAsyncReturn (dart:async-patch/async_patch.dart:290:13)
#11 _DefaultProcessUtils.stream (package:flutter_tools/src/base/process.dart)
#12 _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#13 _rootRunUnary (dart:async/zone.dart:1134:38)
#14 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#15 _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#16 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#17 Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#18 Future._completeWithValue (dart:async/future_impl.dart:524:5)
#19 Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:554:7)
#20 _rootRun (dart:async/zone.dart:1126:13)
#21 _CustomZone.run (dart:async/zone.dart:1023:19)
#22 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#23 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#24 _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#25 _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#26 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#27 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5)
Additional context
Version 6.0.3 works fine
➜ flutter doctor --verbose
[✓] Flutter (Channel beta, v1.12.13+hotfix.5, on Mac OS X 10.15.1 19B88, locale it-IT)
• Flutter version 1.12.13+hotfix.5 at /Users/federico/flutter
• Framework revision 27321ebbad (14 hours ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
• Android SDK at /Users/federico/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.2.1, Build version 11B500
• CocoaPods version 1.8.3
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.40.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.6.0
[✓] Connected device (1 available)
• Nexus 6 • ZX1G425QJK • android-arm • Android 7.1.1 (API 25)
• No issues found!
Same error
Same problem.
@kroikie Please advise:
When looking at the documentation and comparing it with the code in the example project - they are NOT the same.
Is the documentation describing the old way while the example (and plugin code) is using the new v2 embedding?
Problem: documentation out of sync?
Same issue here
Hi @FedericoMatera
could you please try running
flutter clean
flutter pub cache repair
let me know if the issue persists
thank you
the following is not a suggestion or a recomandation,
but upgrading to master
appears to solve a similar issue for some
Temporary workaround:
Downgraded to version 6.0.3.
(Edit: "Works" as in builds) when following current (6.0.8) documentation/instructions.
With Environment:
[✓] Flutter (Channel beta, v1.12.13+hotfix.4, on Mac OS X 10.15.1 19B88, locale en-SE)
• Flutter version 1.12.13+hotfix.4 at /Users/fredrik.dahlen/DEV/flutter
• Framework revision fb60324e6f (3 days ago), 2019-12-09 15:58:15 -0800
• Engine revision ac9391978e
• Dart version 2.7.0
Hi @FedericoMatera
could you please try running
flutter clean
flutter pub cache repair
let me know if the issue persists
thank youthe following is not a suggestion or a recomandation,
but upgrading to master
appears to solve a similar issue for some
Hi @iapicca,
No, that didn't solve the problem
I solved it.. Adding the plugin dependencies in app/build.gradle
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
Same issue here
@jjchiw thanks you save my day
work on IOS and android with version 6.0.3 after added this in app/build.gradle
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
That's a strange fix. Why should we add these dependencies in the gradle config file ?
I don't think you need all of them but you can just add
implementation 'com.google.firebase:firebase-messaging:20.0.1' as it's also used in firebase_messaging itself.
this may help to understand 'https://stackoverflow.com/questions/44493378/whats-the-difference-between-implementation-and-compile-in-gradle?answertab=votes#tab-top'
I believe there will be a fix from the team soon but a temporary fix could be as described.
Same issue. Still broken with latest flutter on master channel and 6.0.9 firebase_messaging
@gerryhigh the solution presented by @mhadaily should work. The team is looking into a solution but you should be able to unblock yourself for now with by adding the dependency directly to your app's build.gradle file.
Yes, that did work. It allowed me to move forward. I then ran into this issue: https://github.com/FirebaseExtended/flutterfire/issues/1591
All you need is only first first line from @jjchiw:
implementation 'com.google.firebase:firebase-messaging:20.0.1'
@jjchiw thanks you save my day
work on IOS and android with version 6.0.3 after added this in app/build.gradle
implementation 'com.google.firebase:firebase-messaging:20.0.1' implementation 'androidx.annotation:annotation:1.1.0' implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
You save me hours of debugging
Hey all 👋
As part of our roadmap (#2582) we've just shipped a complete rework of the firebase_messaging plugin that aims to solve this and many other issues. Dependencies are now managed internally by the plugin itself (see migration guide step on removing the old dependencies from your gradle project).
If you can, please try out the dev release (see the migration guide for upgrading and for changes) and if you have any feedback then join in the discussion here.
Given the scope of the rework I'm going to go ahead and close this issue in favor of trying out the latest plugin.
Thanks everyone.
Most helpful comment
I solved it.. Adding the plugin dependencies in
app/build.gradle