为什么在 pubspec.yaml 中添加 firebase_admob: ^0.11.0+1 在 运行 时会产生错误(Flutter,Android)

Why adding firebase_admob: ^0.11.0+1 in pubspec.yaml generats error when run (Flutter, Android)

我正在尝试在我的应用程序中使用 firebase 和 admob 添加广告,但是当我在 pubspec.yaml 和 运行 项目中添加 firebase_admob: ^0.11.0+1 时,它会生成错误如下所示:并且没有 firebase_admob: ^0.11.0+1 打包我的应用程序 运行s 非常好,我也尝试了这个包的其他版本,但其中 none 有效

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.159b74b36ad352bbcae735fbbcd4399\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

您需要更新 android/build 中的类路径。gradle

来自 :

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

至:

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

也将 https://pub.dev/packages/firebase_core 添加到您的 pubspec.yaml