如何解决谷歌移动广告在颤振项目中出现问题
几个月前我制作并发布了一个 Flutter 应用程序,现在我决定在其中添加 google admobs。该应用程序构建正常,但是一旦我在 pubspec.yaml 中添加了 google_mobile_ads 依赖项,然后尝试运行该应用程序,它就会抛出错误。
请帮助我应该如何进行
错误信息
* 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\acer\.gradle\caches\transforms-2\files-2.1\d63e259ee8b5da2243001c691b062585\play-services-ads-lite-20.1.0\AndroidManifest.xml:27:5-43: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 48s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 49.9s
The build Failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the incompatibility.
Building plugin cloud_firestore...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 3.6s
√ Built build\app\outputs\repo.
Building plugin cloud_firestore_web...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1,470ms
FAILURE: Build Failed with an exception.
* Where:
Build file 'C:\Users\acer\Documents\Flutter\Flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore_web-0.1.1+2\android\build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'cloud_firestore_web'.
> Failed to apply plugin [id 'com.android.library']
> Minimum supported Gradle version is 5.4.1. Current version is 4.10.2. If using the gradle wrapper,try editing the distributionUrl in C:\Users\acer\.gradle\daemon\4.10.2\gradle\wrapper\gradle-wrapper.properties to gradle-5.4.1-all.zip
* 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 1s
Exception: The plugin cloud_firestore_web Could not be built due to the issue above.
我的 pubspec.yaml
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.4+5
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
Flutter:
sdk: Flutter
paginate_firestore: ^0.1.1+1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
path_provider: ^1.6.8
permission_handler: ^5.0.0+hotfix.6
intl: ^0.16.1
ext_storage: ^1.0.3
Flutter_downloader: ^1.4.4
cloud_firestore: ^0.13.5
font_awesome_Flutter: ^8.5.0
dots_indicator: ^1.1.0
carousel_slider: ^1.3.1
sliding_up_panel: ^0.3.6
Flutter_staggered_grid_view: ^0.3.0
provider: ^4.3.1
shared_preferences: ^0.5.4+3
google_sign_in: ^4.4.6
firebase_auth: ^0.16.0
connectivity: ^0.4.5+3
cached_network_image: ^2.2.0+1
launch_review: ^2.0.0
awesome_dialog: ^0.1.4
onesignal_Flutter: ^2.4.1
firebase_analytics: ^5.0.2
firebase_core: 0.4.5
shimmer: ^1.1.1
firebase_admob: ^0.9.3+2
# facebook_audience_network: ^0.5.0
fzwallpaper: ^1.0.2
google_mobile_ads: ^0.13.0
dev_dependencies:
Flutter_test:
sdk: Flutter
Flutter_launcher_icons: "^0.7.3"
Flutter_native_splash: ^0.1.9
Flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/icon.png"
Flutter_native_splash:
image: assets/images/splash.png
color: "ffffff"
Flutter:
# The following line ensures that the Material Icons font is
# included with your application,so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/images/icon.png
- assets/images/splash.png
fonts:
- family: Poppins
fonts:
- asset: assets/fonts/Poppins-Light.ttf
weight: 400
- asset: assets/fonts/Poppins-Regular.ttf
weight: 500
- asset: assets/fonts/Poppins-Medium.ttf
weight: 600
- asset: assets/fonts/Poppins-SemiBold.ttf
weight: 700
- asset: assets/fonts/Poppins-Bold.ttf
weight: 800
解决方法
错误显示 Minimum supported Gradle version is 5.4.1. Current version is 4.10.2.
您可以尝试通过编辑此内容来更新您的成绩版本:
YOUR_APPLICATION_FOLDER/gradle/wrapper/gradle-wrapper.properties 并将最后一行更改为:distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
Android Studio 将下载必要的库。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。