Android Studio Canary 3.4 Canary 4:错误:功能插件不支持variant.getApplicationId() [英] Android Studio Canary 3.4 Canary 4 : ERROR: variant.getApplicationId() is not supported by feature plugins

查看:13
本文介绍了Android Studio Canary 3.4 Canary 4:错误:功能插件不支持variant.getApplicationId()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我在新的 Android Studio 3.4 Canary 4 上更新了我的项目后,gradle 同步失败了,因为:

Since I updated my project on the new Android Studio 3.4 Canary 4, the gradle sync failed because:

ERROR: variant.getApplicationId() is not supported by feature plugins as it cannot handle delayed setting of the application ID. Please use getApplicationIdTextResource() instead.
Affected Modules: base

我之前使用过 Canary 3,它运行良好.

该项目是一个多功能应用,包括一个免安装应用.

The project is a multi feature app including an instant-app.

Gradle 版本是 gradle-5.0-milestone-1-all

Gradle version is gradle-5.0-milestone-1-all

我的项目级 build.gradle

buildscript {

    ext.kotlin_version = '1.3.10'

    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0-alpha04'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha07'
    }

}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {

    compileSdkVersion = 28
    minSdkVersion = 16
    targetSdkVersion = 28

    appVersionCode = 5
    appVersion = "2.0.0-dev01"

}

基础 build.gradle

apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'jacoco'
apply plugin: 'androidx.navigation.safeargs'

android {

    def yo = rootProject

    compileSdkVersion yo.compileSdkVersion

    baseFeature true

    defaultConfig {
        minSdkVersion yo.minSdkVersion
        targetSdkVersion yo.targetSdkVersion
        versionCode yo.appVersionCode
        versionName yo.appVersion
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary true
        multiDexEnabled true
    }

    buildTypes {
        debug {
            testCoverageEnabled !project.hasProperty('android.injected.invoked.from.ide')
            multiDexKeepFile file('multidex-config.txt')
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            multiDexKeepFile file('multidex-config.txt')
        }
    }

    dataBinding {
        enabled = true
    }

    lintOptions {
        disable "InvalidPackage"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

}

repositories {
    mavenCentral()
    google()
}

dependencies {

    application project(':app')
    feature project(':module1')

    [...]

}

app build.gradle

apply plugin: 'com.android.application'

android {

    def yo = rootProject
    compileSdkVersion yo.compileSdkVersion

    defaultConfig {
        applicationId "com.package.name"
        minSdkVersion yo.minSdkVersion
        targetSdkVersion yo.targetSdkVersion
        versionCode yo.appVersionCode
        versionName yo.appVersion
        multiDexEnabled true
    }

    buildTypes {
        debug {
            applicationIdSuffix ".dev"
            splits.abi.enable = false
            splits.density.enable = false
            aaptOptions.cruncherEnabled = false

        }
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding {
        enabled = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

dependencies {

    implementation project(':module1')
    implementation project(':base')

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

}

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

我尝试在没有依赖项的情况下同步我的项目,但它也不起作用.

I tried to sync my project without dependencies but it doest work too.

我也尝试过使缓存无效并重新启动,但没有效果.

I also tried to invalidate caches and restart but no effects.

根据错误日志,问题出在基础 build.gradle 文件中,但我不知道是什么问题.

According to the error log, the problem is in the base build.gradle file but I have no idea what is the problem.

预先感谢您的帮助!

推荐答案

好的,我发现了问题.

这是失败的安全参数导航插件.

apply plugin: 'androidx.navigation.safeargs'

如果我删除这一行,该项目能够同步但不能建立导航安全参数中缺少的类的原因.

If I remove this line, the project is able to sync but not to build cause to classes missing from navigation safeargs.

应用在 baseFeature build.gradle 文件中的 Android Studio 3.4 Canary 4 中的导航插件存在错误.

我会为此发布一个新问题.

I will post a new question for that.

这篇关于Android Studio Canary 3.4 Canary 4:错误:功能插件不支持variant.getApplicationId()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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