从Android Studio构建时,不会增量执行Kotlin编译
我在Android Studio中创建了默认的Android项目,并选择Kotlin作为编程语言。 然后我构建了这个项目(从Android Studio构建时,不会增量执行Kotlin编译,android,android-studio,kotlin,Android,Android Studio,Kotlin,我在Android Studio中创建了默认的Android项目,并选择Kotlin作为编程语言。 然后我构建了这个项目(build->makeproject(F9)) 打开Build Analyzer窗口并展开CompiledBugkotlin任务的详细信息后,我注意到此任务没有以增量方式执行: 为什么Kotlin编译不是增量编译?有什么方法可以实现它吗?默认情况下不应该启用它吗? 将kotlin.incremental=true添加到gradle.properties没有帮助-任务仍然不是
build->makeproject(F9)
)
打开Build Analyzer窗口并展开CompiledBugkotlin
任务的详细信息后,我注意到此任务没有以增量方式执行:
为什么Kotlin编译不是增量编译?有什么方法可以实现它吗?默认情况下不应该启用它吗?
将kotlin.incremental=true
添加到gradle.properties
没有帮助-任务仍然不是增量的
以下是build.gradle文件(它们是由Android Studio创建的默认文件,没有任何修改):
顶级:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.3.72"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
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
}
应用程序模块:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "net.chmielowski.incrementaltesting"
minSdkVersion 29
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
它向我显示了每个任务的
否
,对我来说都是一样的。我专注于Kotlin编译任务,因为我非常确定它应该是增量的。但这可能只是BuildAnalyzer的一个bug。可能会在BuildAnalyzer部分产生一个问题