簡體   English   中英

谷歌移動廣告在 flutter 項目中出現問題

[英]Google mobile ads giving issues in flutter project

幾個月前,我制作並發布了一個 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. 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 將下載必要的庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM