迁移到androidX。该项目正在构建中,但是kotlin扩展未显示可用,代码中的所有 View 均为红色。在gragle.properties中,我将enableJetifier = false置于正常状态,但不可构建。显示重复的类错误。我已经尝试进行清理,重建,失效/重新启动,删除.idea文件夹,但没有任何帮助。将感谢任何有用的答案。
我的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 29
defaultConfig {
applicationId ""
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
versionCode 24
versionName "1.12"
setProperty("archivesBaseName", "}")
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/main.kotlin_module'
}
configurations.all {
resolutionStrategy.force 'com.android.support:multidex:1.0.3'
}
}
androidExtensions {
experimental = true
}
kotlin {
experimental {
coroutines "enable"
}
}
kapt {
generateStubs = true
}
ext {
supportVer = "28.0.0-alpha1"
moxyVer = '1.5.3'
daggerVer = "2.16"
retrofitVer = "2.4.0"
playServicesVer = "15.0.1"
archLifecycleVersion = "1.0.0-rc1"
coroutinesVer = "1.1.1"
}
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVer"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVer"
implementation('com.github.kittinunf.result:result:2.0.0') {
exclude group: 'org.jetbrains.kotlin'
} //for jvm
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation "com.arello-mobile:moxy-app-compat:1.5.3"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt "com.arello-mobile:moxy-compiler:1.5.3"
}
这就是代码中的样子最佳答案
我决定。是我的粗心。我还需要更新Moxy库。