Android Studio Canary 3.4 Canary 4:错误:功能插件不支持variant.getApplicationId()

文斯

由于我在新的Android Studio 3.4 Canary 4上更新了项目,因此gradle同步失败,原因是:

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上工作,效果很好。

该项目是一个多功能应用程序,其中包括即时应用程序。

Gradle版本是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')

    [...]

}

应用程序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'

我试图在没有依赖项的情况下同步我的项目,但它也无法正常工作。

我还尝试使缓存无效并重新启动,但没有效果。

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

预先感谢您的帮助!

文斯

好的,我找到了问题。

这是失败安全args导航插件

apply plugin: 'androidx.navigation.safeargs'

如果删除此行,则该项目能够同步但无法建立导致导航safeargs缺少类的原因。

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

我将为此发布一个新问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Android Studio 3.0 Canary 4构建错误

Android Studio 3.0 Canary 4模拟器陷入重启

Android Studio 3.6 Canary 4-Gradle引发DefaultProjectSyncIssues异常

Android Studio 3.6 Canary 4-Gradle引发DefaultProjectSyncIssues异常

Android Studio 3.1 Canary 3上的Gradle同步错误

Android Studio 3.4 Canary 3 编译错误

Android Studio 3.0 Canary 2 更新错误

Android Studio Canary 5更新错误

Android studio 3.0 Canary 4 在构建即时应用程序时抛出错误

使用Android Studio 3.0 Canary 3进行数据绑定

Android Studio 3.1 Canary 3 - Gradle 项目同步失败

Android Studio 3.1 Canary 3-Gradle同步失败

使用Android Studio 3 Canary 1的app:transformClassesWithDesugarForMockDebug

ConstraintLayout在GUI编辑器Android Studio 3.0中不起作用-Canary 4

Android Studio 3.0 Canary 1注解处理器错误

flavourDimensions gradle错误-Android Studio 3.0 Canary 1

Android Studio 3.0 canary 1:SQL 语法错误

Android Studio 3.0 Canary 1:Gradle同步错误

如何安装Android Studio 3.5 Canary 12?

Android Studio 3.2 Canary 14 Github集成

Android Studio Canary 4.1内存设置

Android Studio 3.0 Canary 3中的org.gradle.tooling.BuildException

更新到Android Studio 2.3 Canary 3后,Gradle构建失败

更新到 android studio preview 3.0 canary 3 后无法构建项目

安装Canary 7后无法打开Android Studio 4.2 Canary 8或9

使用Android Studio 3.2 Canary 17时出现kotlin-android错误

Android Studio 3.0 Canary 5中没有“包括Kotlin支持”复选框

Android Studio 3.0 Canary 1:项目刷新失败

尝试使用 Jetpack Compose 必须需要 Android Studio canary 吗?