【问题标题】:Why adding firebase_admob: ^0.11.0+1 in pubspec.yaml generats error when run (Flutter, Android)为什么在运行时在 pubspec.yaml 中添加 firebase_admob: ^0.11.0+1 会产生错误(Flutter,Android)
【发布时间】:2021-05-29 10:48:33
【问题描述】:

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


    【解决方案1】:

    你需要更新 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

    【讨论】:

      猜你喜欢
      • 2021-10-03
      • 1970-01-01
      • 1970-01-01
      • 2014-07-23
      • 1970-01-01
      • 2021-02-03
      • 1970-01-01
      • 2015-02-22
      • 2019-08-23
      相关资源
      最近更新 更多