例外:由于上述问题,无法构建插件 firebase_admob [英] Exception: The plugin firebase_admob could not be built due to the issue above

查看:28
本文介绍了例外:由于上述问题,无法构建插件 firebase_admob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<块引用><块引用>

FAILURE:构建失败,出现异常.

  • 出了什么问题:任务:app:processDebugResources"执行失败.
<块引用>

执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障Android 资源链接失败/home/mohamed/.gradle/caches/transforms-2/files-2.1/804bb16bf16b5e91bc08a39b6997ce12/play-services-ads-lite-19.6.0/AndroidManifest.xml:27:5-38:15:AAPT:错误:在 .2

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

  • https://help.gradle.org

    获得更多帮助

BUILD FAILED in 10s 构建失败可能是由于 AndroidX插件中的不兼容性.该工具即将尝试使用 Jetfier来解决不兼容问题.构建插件 firebase_admob...例外:插件 firebase_admob 由于上面的问题.退出(sigterm)

在此处输入图片说明

gradle.proprieties

org.gradle.jvmargs=-Xmx1536Mandroid.useAndroidX=trueandroid.enableJetifier=真android.enableR8=真

build.gradle :

buildscript {ext.kotlin_version = '1.3.50'存储库{谷歌()jcenter()}依赖{类路径 'com.android.tools.build:gradle:3.5.0'classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version";}}所有项目{存储库{谷歌()jcenter()}}rootProject.buildDir = '../build'子项目{project.buildDir = "${rootProject.buildDir}/${project.name}";}子项目{project.evaluationDependsOn(':app')}任务清理(类型:删除){删除 rootProject.buildDir}

build.gradle

def localProperties = new Properties()def localPropertiesFile = rootProject.file('local.properties')如果(localPropertiesFile.exists()){localPropertiesFile.withReader('UTF-8') { reader ->localProperties.load(阅读器)}}def flutterRoot = localProperties.getProperty('flutter.sdk')if (flutterRoot == null) {throw new GradleException(未找到 Flutter SDK.在 local.properties 文件中使用 flutter.sdk 定义位置.")}def flutterVersionCode = localProperties.getProperty('flutter.versionCode')if (flutterVersionCode == null) {颤振版本代码 = '1'}def flutterVersionName = localProperties.getProperty('flutter.versionName')if (flutterVersionName == null) {颤振版本名称 = '1.0'}应用插件:'com.android.application'应用插件:'kotlin-android'申请自:$flutterRoot/packages/flutter_tools/gradle/flutter.gradle";安卓 {compileSdkVersion 29源集{main.java.srcDirs += 'src/main/kotlin'}lintOptions {禁用无效包"}默认配置{//TODO:指定您自己的唯一应用程序 ID (https://developer.android.com/studio/build/application-id.html).applicationIdcom.example.admob10"minSdk 版本 16目标SDK版本29versionCode flutterVersionCode.toInteger()版本名称 flutterVersionName}构建类型{释放 {//TODO:为发布版本添加您自己的签名配置.//现在使用调试密钥签名,所以 `flutter run --release` 可以工作.签名配置signingConfigs.debug}}}颤动{来源 '../..'}依赖{实现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")

问题立即消失了.:)

i have a problems this bug appears when i add the plugin " firebase_admob: ^0.11.0+1" in pubspec.yaml

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 /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

  • 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 10s 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 firebase_admob... Exception: The plugin firebase_admob could not be built due to the issue above. Exited (sigterm)

enter image description here

gradle.proprieties

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true

build.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
}

build.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"
}

解决方案

I too solved the issue by upgrading build gradle version.

  • previous setting in build.gradle file of project was:

    classpath("com.android.tools.build:gradle:3.5.0")
    

  • current setting:

    classpath("com.android.tools.build:gradle:3.5.4")
    

The issue was gone immediately. :)

这篇关于例外:由于上述问题,无法构建插件 firebase_admob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆