Добавление рекламы в мое приложение flutter устраняет множество ошибок

#android #firebase #flutter #dart #admob

#Android #firebase #flutter #dart #admob

Вопрос:

Когда я пытаюсь добавить рекламу в свое приложение, выполняя все, что мне говорят firebase и admobs, я получаю множество ошибок. Прежде всего, когда я добавляю эту строку в build.gradle в папке Android implementation 'com.google.android.gms:play-services-ads:19.3.0' в dependencies, я получаю эту ошибку `

СБОЙ: сбой сборки с исключением.

  • Где: Файл сборки ‘/Users/giordanoragnacci/AndroidStudioProjects / dices_app / android/build.gradle’ строка: 9

  • Что пошло не так: возникла проблема при оценке корневого проекта «android».

Не удалось найти реализацию метода() для аргументов [com.google.android.gms:play-services-ads: 19.3.0] для объекта типа org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Попробуйте: Запустите с параметром —stacktrace, чтобы получить трассировку стека. Запустите с параметром —info или —debug, чтобы получить больше выходных данных журнала. Запустите с помощью —scan, чтобы получить полную информацию.

  • Получите дополнительную помощь на https://help.gradle.org

`Также, когда я импортирую firebase.dart в свой домашний файл, я получаю эту большую ошибку

 Compiler message:
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
       ^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js.dart:8:1: Error: Not found: 'dart:js'
export 'dart:js' show allowInterop, allowInteropCaptureThis;
^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/js_util.dart:8:1: Error: Not found: 'dart:js_util'
export 'dart:js_util';
^

BUILD FAILED in 1s
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:306:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) {
                        ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:310:26: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => _changeController.addError(e));
                         ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:340:25: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var nextWrapper = allowInterop((firebase_interop.UserJsImpl user) {
                        ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart:345:11: Error: The method 'allowInterop' isn't defined for the class 'Auth'.
 - 'Auth' is from 'package:firebase/src/auth.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/auth.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((e) => _idTokenChangedController.addError(e));
          ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:164:9: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
 - 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((update) => jsify(transactionUpdate(dartify(update))));
        ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:166:26: Error: The method 'allowInterop' isn't defined for the class 'DatabaseReference<T>'.
 - 'DatabaseReference' is from 'package:firebase/src/database.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var onCompleteWrap = allowInterop(
                         ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:301:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/database.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var callbackWrap = allowInterop((database_interop.DataSnapshotJsImpl data,
                       ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:325:30: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/database.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    jsObject.once(eventType, allowInterop(
                             ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart:402:22: Error: The method 'allowInterop' isn't defined for the class 'DataSnapshot'.
 - 'DataSnapshot' is from 'package:firebase/src/database.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/database.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var actionWrap = allowInterop((d) => action(DataSnapshot.getInstance(d)));
                     ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart:72:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((payload) {
                          ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart:75:28: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final errorWrapper = allowInterop((e) {
                           ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart:87:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((payload) {
                          ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart:97:27: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final nextWrapper = allowInterop((_) => null);
                          ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart:98:28: Error: The method 'allowInterop' isn't defined for the class 'Messaging'.
 - 'Messaging' is from 'package:firebase/src/messaging.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/messaging.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      final errorWrapper = allowInterop((e) {
                           ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/storage.dart:317:11: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((storage_interop.UploadTaskSnapshotJsImpl data) {
          ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/storage.dart:321:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => _changeController.addError(e));
                         ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/storage.dart:322:26: Error: The method 'allowInterop' isn't defined for the class 'UploadTask'.
 - 'UploadTask' is from 'package:firebase/src/storage.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/storage.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var onCompletion = allowInterop(() => _changeController.close());
                         ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:194:7: Error: Method not found: 'hasProperty'.
  if (js.hasProperty(error, 'message')) {
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/top_level.dart:195:19: Error: Method not found: 'getProperty'.
    var message = js.getProperty(error, 'message');
                  ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:29:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(jsObject, 'firestore') amp;amp;
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:30:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(jsObject, 'id') amp;amp;
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:31:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(jsObject, 'parent')) {
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:37:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(jsObject, 'latitude') amp;amp;
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:38:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(jsObject, 'longitude') amp;amp;
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:44:15: Error: Method not found: 'getProperty'.
  var proto = util.getProperty(jsObject, '__proto__');
              ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:46:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(proto, 'toDate') amp;amp;
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:47:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(proto, 'toMillis')) {
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:52:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(proto, 'isEqual') amp;amp;
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:53:7: Error: Method not found: 'hasProperty'.
      util.hasProperty(proto, 'toBase64')) {
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:67:24: Error: Method not found: 'getProperty'.
    map[key] = dartify(util.getProperty(jsObject, key));
                       ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:91:17: Error: Method not found: 'newObject'.
    var jsMap = util.newObject();
                ^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:93:7: Error: Method not found: 'setProperty'.
      util.setProperty(jsMap, key, jsify(value));
      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:116:12: Error: Method not found: 'allowInterop'.
    return allowInterop(dartObject);
           ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:124:5: Error: Method not found: 'callMethod'.
    util.callMethod(jsObject, method, args);
    ^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:139:19: Error: Method not found: 'promiseToFuture'.
    value = await util.promiseToFuture(thenable);
                  ^^^^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:141:9: Error: Method not found: 'hasProperty'.
    if (util.hasProperty(e, 'code')) {
        ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:152:27: Error: Method not found: 'allowInterop'.
  return PromiseJsImpl<S>(allowInterop((
                          ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:165:5: Error: Method not found: 'allowInterop'.
    allowInterop(c.completeError);
    ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:173:22: Error: Method not found: 'getProperty'.
  String get code => util.getProperty(_source, 'code');
                     ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:176:25: Error: Method not found: 'getProperty'.
  String get message => util.getProperty(_source, 'message');
                        ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:179:22: Error: Method not found: 'getProperty'.
  String get name => util.getProperty(_source, 'name');
                     ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:182:32: Error: Method not found: 'getProperty'.
  Object get serverResponse => util.getProperty(_source, 'serverResponse');
                               ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/utils.dart:185:23: Error: Method not found: 'getProperty'.
  String get stack => util.getProperty(_source, 'stack');
                      ^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:105:30: Error: The method 'allowInterop' isn't defined for the class 'Firestore'.
 - 'Firestore' is from 'package:firebase/src/firestore.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var updateFunctionWrap = allowInterop((transaction) =>
                             ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:306:11: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
 - 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
          allowInterop((firestore_interop.DocumentSnapshotJsImpl snapshot) {
          ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:310:26: Error: The method 'allowInterop' isn't defined for the class 'DocumentReference'.
 - 'DocumentReference' is from 'package:firebase/src/firestore.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
      var errorWrapper = allowInterop((e) => controller.addError(e));
                         ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:445:9: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/firestore.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((firestore_interop.QuerySnapshotJsImpl snapshot) {
        ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:449:24: Error: The method 'allowInterop' isn't defined for the class 'Query<T>'.
 - 'Query' is from 'package:firebase/src/firestore.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
    var errorWrapper = allowInterop((e) => controller.addError(e));
                       ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart:775:9: Error: The method 'allowInterop' isn't defined for the class 'QuerySnapshot'.
 - 'QuerySnapshot' is from 'package:firebase/src/firestore.dart' ('../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/firestore.dart').
Try correcting the name to the name of an existing method, or defining a method named 'allowInterop'.
        allowInterop((s) => callback(DocumentSnapshot.getInstance(s)));
        ^^^^^^^^^^^^
../../dartsdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/src/interop/js_interop.dart:17:7: Error: Method not found: 'hasProperty'.
  if (util.hasProperty(jsObject, 'toDateString')) {
      ^^^^^^^^^^^
../../dartsdk/flutter/packages/flutter/lib/src/painting/_network_image_web.dart:88:12: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
    return ui.webOnlyInstantiateImageCodecFromUrl(resolved, // ignore: undefined_function
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Exception: Gradle task assembleDebug failed with exit code 1
  

Кто-нибудь, пожалуйста, помогите.
Это файл моего приложения / build.gradle

 def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.ongar.dices_app"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

  

И это мой файл android / build.gradle.

 buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        implementation 'com.google.android.gms:play-services-ads:19.3.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  

Ответ №1:

в файле app / build.gradle вы отсутствуете,

 apply plugin: 'com.google.gms.google-services'
  

И вам не нужно implementation 'com.google.android.gms:play-services-ads:19.3.0'

Вместо этого вы должны использовать плагин Admob Flutter (https://pub.dev/packages/firebase_admob)

Комментарии:

1. Я удалил реализацию ‘com.google.android.gms:play-services-ads: 19.3.0’ и добавил ту строку, которую вы опубликовали, но все равно, когда я импортирую ‘package: firebase / firebase.dart’; это выдает мне второй журнал ошибок, который я опубликовал

2. Редактировать: я импортировал неправильную библиотеку, поэтому теперь я импортировал правильные, но теперь это выдает мне эту ошибку: FAILURE: Build failed with an exception. * Where: Build file '/Users/giordanoragnacci/AndroidStudioProjects/dices_app/android/app/build.gradle' line: 25 * What went wrong: A problem occurred evaluating project ':app'. > Plugin with id 'com.google.gms.google-services' not found. * 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. BUILD FAILED in 1s

3. в файле android / build.gradle есть ли у вас эта строка в разделе зависимости? classpath 'com.google.gms:google-services:4.3.3'