Android Studio Canary 3.4 Canary 4:错误:功能插件不支持variation.getAp



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

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

我之前在《金丝雀3号》上,效果很好

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

Gradle版本为Gradle-5.0-中位-1-全

我的项目级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"
}

基本构建等级

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')
[...]
}

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

如果我删除这一行,项目可以同步,但不能构建导航保险箱中缺少的类。

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

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

对于有类似问题的人,请确保project-level build.gradle中的所有依赖项都是最新的。

例如,当我的谷歌服务插件版本过时时,我遇到了这个问题:

buildscript {
repositories {
...
}
dependencies {
...
classpath 'com.google.gms:google-services:4.0.1'
}
}

更新到最新版本后,问题得到了解决:

buildscript {
repositories {
...
}
dependencies {
...
classpath 'com.google.gms:google-services:4.2.0'
}
}

最新更新