Android Studio 3.2.1
在项目build.gradle中:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在app / build.gradle中:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
kapt {
arguments {
arg("resourcePackageName", android.defaultConfig.applicationId)
arg("androidManifestFile", variant.outputs[0]?.processResourcesTask?.manifestFile)
}
}
但是我得到了错误:
Could not get unknown property 'processResourcesTask' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[], versionCode=421, versionName=2.1.421}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl.
在build:gradle:3.2.1
之前一切正常。