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

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

我正在尝试在我的应用程序中使用 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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?