【问题标题】:Build failed with an exception error Flutter with Google Ads构建失败并出现异常错误 Flutter with Google Ads
【发布时间】:2021-07-06 15:48:43
【问题描述】:

FAILURE:构建失败并出现异常。

  • 出了什么问题: 任务“:app:processDebugResources”执行失败。

执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障 Android资源链接失败 C:\Users\afran.gradle\caches\transforms-2\files-2.1\64c98a67cb9daf6485fbefd78c4aebac\play-services-ads-lite-19.7.0\AndroidManifest.xml:27:5-43:15:AAPT:错误:意外中找到的元素。

  • 尝试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。

  • 通过https://help.gradle.org获得更多帮助

在 5 秒内构建失败 构建失败可能是由于插件中的 AndroidX 不兼容。该工具即将尝试使用Jetifier解决不兼容问题。 构建插件 cloud_firestore... 运行 Gradle 任务“assembleAarRelease”... 例外:由于上述问题,无法构建插件 cloud_firestore。 这些是我正在使用的依赖项

dependencies:
  flutter:
    sdk: flutter
  google_mobile_ads: ^0.12.0
  flutter_spinkit: ^5.0.0
  #geolocation: ^1.1.2
  cloud_firestore: ^1.0.3
  firebase_storage: ^8.0.0
  permission_handler: ^6.0.1+1
  firebase_core: ^1.0.1
  url_launcher: ^6.0.2
  firebase_auth: ^1.0.1
  provider: ^5.0.0
  google_fonts: ^2.0.0
  shared_preferences: ^2.0.4
  connectivity: ^3.0.2
  mailer: ^4.0.0
  firebase_messaging: ^9.1.0
  flutter_local_notifications: ^5.0.0+1

我的 Bulid.gradle

android {
    compileSdkVersion 30

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.afran.form_app"
        minSdkVersion 22
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName

    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

【问题讨论】:

    标签: flutter flutter-dependencies googlemobileads


    【解决方案1】:

    我刚刚找到了解决方案,查询是一个新的清单元素,需要使用新的 gralde android 插件。

    所以在 build.gradle 中更改为这个版本,这对我有用

    classpath 'com.android.tools.build:gradle:4.1.0
    

    还将 gradle-wrapper 版本更改为 6.5,因为 4.1.0 插件需要它

    【讨论】:

      猜你喜欢
      • 2019-02-23
      • 2022-01-06
      • 2020-06-13
      • 2021-01-25
      • 2021-09-24
      • 1970-01-01
      • 1970-01-01
      • 2022-07-07
      • 1970-01-01
      相关资源
      最近更新 更多