0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

FlutetrでrequestPermissionのエラー

Posted at

FlutetrでrequestPermissionのエラー

Flutterで通知アプリ仕込んでます。

あと少しだったのですが、このエラーが出てAndroid版のビルドはできるのですが、アプリが起動しない。この時点でiOS版はビルド通っていた。

エラーは

E/flutter ( 5307): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: MissingPluginException(No implementation found for method Messaging#requestPermission on channel plugins.flutter.io/firebase_messaging)
E/flutter ( 5307): #0      convertPlatformException (package:firebase_messaging_platform_interface/src/method_channel/utils/exception.dart:13)
E/flutter ( 5307): #1      MethodChannelFirebaseMessaging.requestPermission (package:firebase_messaging_platform_interface/src/method_channel/method_channel_messaging.dart:286)
E/flutter ( 5307): <asynchronous suspension>
E/flutter ( 5307): #2      main (package:(パッケージ名)/main.dart:91)

結局、main.dart:91にあるスマホに通知許可を出してもらうところが不要だったようです。

main.dart
  await FirebaseMessaging.instance.requestPermission(
    announcement: true,
    carPlay: true,
    criticalAlert: true,
  );

を、全部コメントアウトして

main.dart
  // await FirebaseMessaging.instance.requestPermission(
  //   announcement: true,
  //   carPlay: true,
  //   criticalAlert: true,
  // );

こうしてビルドできました。

AndroidManifest.xmlやらいじったのですがなおらず。

レセイに見るとpermissions.dartでrequestPermissionしてるので、そのあたりが問題かなと。
ほぼメモです。すみません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?