gpt4 book ai didi

flutter - 异常 : The plugin firebase_admob could not be built due to the issue above

转载 作者:行者123 更新时间:2023-12-04 12:16:00 35 4
gpt4 key购买 nike

我有问题
当我在 pubspec.yaml 中添加插件“firebase_admob: ^0.11.0+1”时出现此错误

FAILURE: Build failed with an exception.


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

  • A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacadeAndroid resource linking failed/home/mohamed/.gradle/caches/transforms-2/files-2.1/804bb16bf16b5e91bc08a39b6997ce12/play-services-ads-lite-19.6.0/AndroidManifest.xml:27:5-38:15:AAPT: error: unexpected element found in . 2


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

  • 10 秒内构建失败 构建失败可能是由于 AndroidX
    插件中的不兼容性。该工具即将尝试使用 Jetfier
    来解决不兼容问题。构建插件 firebase_admob...
    异常(exception):插件 firebase_admob 由于
    上面的问题。退出(sigterm)

    enter image description here
    gradle.proprieties
    org.gradle.jvmargs=-Xmx1536M
    android.useAndroidX=true
    android.enableJetifier=true
    android.enableR8=true
    构建.gradle:
    buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
    google()
    jcenter()
    }

    dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
    }

    allprojects {
    repositories {
    google()
    jcenter()
    }
    }

    rootProject.buildDir = '../build'
    subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
    project.evaluationDependsOn(':app')
    }

    task clean(type: Delete) {
    delete rootProject.buildDir
    }
    构建.gradle
    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file('local.properties')
    if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
    localProperties.load(reader)
    }
    }

    def flutterRoot = localProperties.getProperty('flutter.sdk')
    if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
    }

    def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
    if (flutterVersionCode == null) {
    flutterVersionCode = '1'
    }

    def flutterVersionName = localProperties.getProperty('flutter.versionName')
    if (flutterVersionName == null) {
    flutterVersionName = '1.0'
    }

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

    android {
    compileSdkVersion 29

    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.example.admob10"
    minSdkVersion 16
    targetSdkVersion 29
    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 {
    source '../..'
    }

    dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    }

    最佳答案

    我也通过升级 build gradle 版本解决了这个问题。

  • build.gradle 中的先前设置项目文件是:
    classpath("com.android.tools.build:gradle:3.5.0")
  • 当前设置:
    classpath("com.android.tools.build:gradle:3.5.4")

  • 问题立马消失了。 :)

    关于flutter - 异常 : The plugin firebase_admob could not be built due to the issue above,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65857643/

    35 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com