[flutter] firebase message 사용시 오류 (Member not found)
요즘 계속해서 관련글이 올라오긴 하는데.. 구형 Mac에서 flutter로 개발중이다.
나의 환경
구형 Mac을 사용하다보니, 서로 연관이 되어서, 관련 개발툴 버전도 좀 옛 버전이 설치되어있는데, 그래서 그런지 호환 관련 오류가 발생하는 경우가 좀 생긴다.
이번에는 firebase message를 사용하려고 하는데 다음과 같은 오류가 떴다.
firebase message 사용시 오류 메시지
우선 맥에서 뜬 오류
Launching lib/main.dart on iPhone 12 in debug mode... Running Xcode build... Xcode build done. 62.7s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED ** Xcode's output: ↳ ../../develop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11: Error: Member not found: 'Error.throwWithStackTrace'. Error.throwWithStackTrace(exception, stackTrace); ^^^^^^^^^^^^^^^^^^^ ../../develop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:16:9: Error: Member not found: 'Error.throwWithStackTrace'. Error.throwWithStackTrace( ^^^^^^^^^^^^^^^^^^^ ../../develop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:11:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null. Never convertPlatformException(Object exception, StackTrace stackTrace) { ^ Failed to package /Users/nissi/FlutterProjects/firebase_example. Command PhaseScriptExecution failed with a nonzero exit code note: Using new build system note: Building targets in parallel note: Planning build note: Constructing build description Could not build the application for the simulator. Error launching application on iPhone 12.
윈도우 PC에서 오류 메시지
Launching lib\main.dart on sdk gphone x86 in debug mode... Running Gradle task 'assembleDebug'... ../../flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:13:11: Error: Member not found: 'Error.throwWithStackTrace'. Error.throwWithStackTrace(exception, stackTrace); ^^^^^^^^^^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:16:9: Error: Member not found: 'Error.throwWithStackTrace'. Error.throwWithStackTrace( ^^^^^^^^^^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging_platform_interface-3.2.0/lib/src/method_channel/utils/exception.dart:11:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null. Never convertPlatformException(Object exception, StackTrace stackTrace) { ^ FAILURE: Build failed with an exception. * Where: Script 'E:\Flutter_work\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1070 * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command 'E:\Flutter_work\flutter\bin\flutter.bat'' finished with non-zero exit value 1 * 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 42s Exception: Gradle task assembleDebug failed with exit code 1
뭐.. 멤버를 못찾고, 어디서부터 봐야하나.. 이것저것 구글링도 해보고 했든데..
일단 다음과 같이 해결했다.
한줄결론 (해결방안)
pubspec.yaml 파일의 dependencies: 에 다음과 같이 추가
firebase_messaging_platform_interface: 3.1.6