

Flutterでadmobパッケージをインストールし、バナー広告を出そうとしましたが、下記のエラーで困っています。

試したこと

  * info.splitにGADApplicationIdentifierを追加
  * main.dartにMobileAds.instance.initialize();を追加

[code]

    Showing All Messages
    ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/google_mobile_ads-2.3.0/lib/src/ump/user_messaging_codec.dart:27:19: Error: Type 'WriteBuffer' not found.
    
      void writeValue(WriteBuffer buffer, dynamic value) {
    
                      ^^^^^^^^^^^
    
    ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/google_mobile_ads-2.3.0/lib/src/ump/user_messaging_codec.dart:45:41: Error: Type 'ReadBuffer' not found.
    
      dynamic readValueOfType(dynamic type, ReadBuffer buffer) {
    
                                            ^^^^^^^^^^
    
    ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/google_mobile_ads-2.3.0/lib/src/ump/user_messaging_codec.dart:27:19: Error: 'WriteBuffer' isn't a type.
    
      void writeValue(WriteBuffer buffer, dynamic value) {
    
                      ^^^^^^^^^^^
    
    ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/google_mobile_ads-2.3.0/lib/src/ump/user_messaging_codec.dart:45:41: Error: 'ReadBuffer' isn't a type.
    
      dynamic readValueOfType(dynamic type, ReadBuffer buffer) {
    
                                            ^^^^^^^^^^
    
    Failed to package /Users/name/Project/MyProject/appname.
    
    Command PhaseScriptExecution failed with a nonzero exit code
    
[/code]


CC BY-SA 4.0
2022-12-04T00:09:32.937
92562
2023-03-28T15:44:37.870
2022-12-04T04:35:06.717
3060
55755
question
flutter admob
Flutter admobパッケージのインストール後のエラーが解決できない。


こちらに解決方法が提案されているので実践してみてはいかがでしょうか。  
<https://github.com/googleads/googleads-mobile-flutter/issues/668>


CC BY-SA 4.0
2023-03-28T15:44:37.870
94362
2023-03-28T15:44:37.870
53335
92562
answer