问题描述
我正在尝试在我的应用程序中使用 firebase 和 admob 添加广告,但是当我在 pubspec.yaml 中添加 firebase_admob: ^0.11.0+1 并运行项目时,它会产生如下所示的错误:并且没有 firebase_admob: ^0.11。 0+1 包我的应用程序运行得很好,我也尝试过这个包的其他版本,但没有一个成功
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
解决方法
你需要更新android/build.gradle中的classpath
来自:
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