如何解决例外:由于上述问题,无法构建插件 firebase_admob
我有问题 当我在 pubspec.yaml 中添加插件“firebase_admob: ^0.11.0+1”时出现此错误
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
BUILD Failed in 10s 构建失败可能是由于 AndroidX 插件中的不兼容性。该工具即将尝试使用 Jetfier 来解决不兼容问题。构建插件 firebase_admob... 例外:插件 firebase_admob 由于 上面的问题。退出(sigterm)
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"
}
解决方法
我也通过升级构建 gradle 版本解决了这个问题。
- 项目的
build.gradle
文件中的先前设置是:classpath("com.android.tools.build:gradle:3.5.0")
- 当前设置:
classpath("com.android.tools.build:gradle:3.5.4")
问题立即消失了。 :)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。