无法创建变体'android-manifest-metadata'

Mar*_*pho 13 android gradle

我上传我的应用程序在Playstore(bundle.aab方法),它工作正常,没有错误的Android 6.0但在Android 7.0设备上得到错误,并没有运行应用程序.我使用了Gradle构建类路径3.1.0 - 尝试通过将Gradle版本构建更新为3.2.0-alpha14来解决问题,因此编译失败时给出了错误消息.有谁知道如何解决这个问题,让我的应用程序在使用Gradle 4.7的Android 7.0设备上运行?也许这个升级修复了我认为的设备错误.谢谢!

apply plugin: 'com.android.application'


repositories {
    mavenLocal()
    maven {
        url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
    }
}

android {
    signingConfigs {
    config {
        keyAlias 'key1'
        keyPassword '*****'
        storeFile file('C:/Users/marco/.android/debug.keystore')
        storePassword 'android'
    }
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
    defaultConfig {
        multiDexEnabled true
        applicationId "net.panomaps"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 63
        versionName "5.3.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    javaCompileOptions {
            annotationProcessorOptions {
            includeCompileClasspath true
            }
        }
        vectorDrawables.useSupportLibrary = true
    }
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
    }
    debug {
        signingConfig signingConfigs.config
    }
}
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

    dependencies {
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.android.support:design:27.1.1'
        implementation 'com.android.support.constraint:constraint-layout:1.1.0'
        implementation 'com.android.support:support-vector-drawable:27.1.1'
        implementation 'com.google.android.gms:play-services-auth:15.0.1'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation 'com.google.firebase:firebase-core:15.0.2'
        implementation 'com.google.firebase:firebase-appindexing:15.0.1'
        implementation 'com.google.firebase:firebase-config:15.0.2'
        implementation 'com.google.firebase:firebase-invites:15.0.1'
        implementation 'pub.devrel:easypermissions:1.1.2'
        implementation 'com.google.firebase:firebase-messaging:15.0.2'
        implementation 'org.xwalk:xwalk_core_library:23.53.589.4'
        implementation 'com.squareup.picasso:picasso:2.5.2'
        implementation 'com.firebaseui:firebase-ui-auth:3.1.3'
        implementation 'com.firebaseui:firebase-ui:3.1.3'
        implementation 'com.google.firebase:firebase-auth:15.1.0'
        implementation 'com.google.firebase:firebase-database:15.0.1'

        implementation 'com.github.Q42:AndroidScrollingImageView:1.3.2'

        implementation 'com.android.support:multidex:1.0.3'
    }

apply plugin: 'com.google.gms.google-services'


    // error message -> Cannot create variant 'android-manifest-metadata' after configuration ':app:debugApiElements' has been resolved
Run Code Online (Sandbox Code Playgroud)

Gradle distributionUrl = https://services.gradle.org/distributions/gradle-4.7-all.zip

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
    classpath 'com.google.gms:google-services:3.3.0'
    }
}
Run Code Online (Sandbox Code Playgroud)

错误消息 - >配置后无法创建变体'android-manifest-metadata':app:debugApiElements'已经解决

luc*_*ler 45

该问题与谷歌服务有关

升级firebase版本和/或gradle插件版本后,我还必须升级google服务插件版本

dependencies {
    classpath 'com.google.gms:google-services:4.0.1'
} 
Run Code Online (Sandbox Code Playgroud)


Ioa*_*s I 9

有相同的问题,并在我更新到最新版本时得到解决:

classpath 'com.android.tools.build:gradle:3.3.0-alpha02'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'
Run Code Online (Sandbox Code Playgroud)


小智 5

更新到最新版本无济于事。在我们的案例中,问题是由我们的自定义Gradle任务引起的,该任务正在解决项目配置过程中的依赖项。

要找到此类任务,请先使用(例如)运行Gradle Build Scan。然后转到生成的扫描页面,性能->设置和建议。如果有警告说,那么您将很乐意解决这些问题。--scan./gradlew app:assembleDebug --scanDependencies were resolved during project configuration

在我们的例子中,这是一个自定义任务,正在variant.javaCompiler.classpath.files配置步骤中访问。尝试搜索configurations.或.files在Gradle脚本中查找潜在的问题,并先将其注释掉,然后重新运行“构建扫描”以查看问题是否消失。

以下链接可以帮助您理解问题: