Почему добавление firebase_admob: ^ 0.11.0 + 1 в pubspec.yaml генерирует ошибку при запуске (Flutter, Android)

Я пытаюсь добавить рекламу с помощью firebase и admob в свое приложение, но когда я добавляю firebase_admob: ^ 0.11.0 + 1 в pubspec.yaml и запускаю проект, он генерирует ошибку, как показано ниже: и без firebase_admob: ^ 0.11.0 + 1 package мое приложение работает очень хорошо, я также пробовал другую версию этого пакета, но ни один из них не работал

Launching lib\main.dart on SM M307F in debug mode...
 lib\main.dart
Parameter format not correct -

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\Anil\.gradle\caches\transforms-2\files-2.1\6359b74b36ad352bbcae735fbbcd4399\play-services-ads-lite-19.6.0\AndroidManifest.xml:27:5-38:15: AAPT: error: unexpected element <queries> found in <manifest>.

* 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 17s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin audioplayers...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'audioplayers'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* 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 2s
Exception: The plugin audioplayers could not be built due to the issue above.
Exited (sigterm)

Пакеты, которые я использую:

dependencies:
  flutter:
    sdk: flutter

  torch_compat: ^1.0.2
  screen: ^0.0.5
  battery_info: ^1.0.7
  shake: ^0.1.0
  provider: ^4.3.3
  shared_preferences: ^0.5.12+4
  audioplayers: ^0.16.1
  vibration: ^1.7.3
  share: ^0.6.5+4
  flutter_email_sender: ^4.0.0
  firebase_admob: ^0.11.0+1

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0


person Anil Shrivastav    schedule 27.02.2021    source источник


Ответы (1)


Вам нужно обновить путь к классам в android / build.gradle

из :

classpath 'com.android.tools.build:gradle:3.5.0'

to :

classpath 'com.android.tools.build:gradle:3.5.4'

также добавьте https://pub.dev/packages/firebase_core в свой pubspec.yaml

person TDN    schedule 27.02.2021