我更新了我的Android Studio和gradle这个到3.3.0版本后,我不能编译我的应用程序。由科特林Android的扩展所提供的意见不起作用。我有“未解决参考:XXX”的编译错误,我引用的所有意见。
在先前从gradle这个和Android工作室我的代码的作品版本。我试图清理和重建我的项目,废止高速缓存,并重新启动了Android Studio并创建一个新的项目,并复制和我的代码粘贴到它,但是这一切都无法正常工作。
我的项目.gradle包含:
buildscript {
ext.kotlin_version = "1.3.20"
ext.play_sevices_version="16.0.0"
repositories {
google()
mavenCentral()
jcenter()
maven {
url "https://maven.fabric.io/public"
}
}
dependencies {
classpath "com.android.tools.build:gradle:3.3.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
classpath "com.google.gms:google-services:4.2.0"
classpath "io.fabric.tools:gradle:1.25.4"
}
}
我的应用程序.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: "io.fabric"
android {
compileSdkVersion 28
defaultConfig {
....
minSdkVersion 16
targetSdkVersion 28
...
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.github.StephenVinouze:KinApp:1.0.2'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-ads:17.1.3'
implementation "com.google.android.gms:play-services-maps:$play_sevices_version"
implementation "com.google.android.gms:play-services-location:$play_sevices_version"
implementation "com.google.android.gms:play-services-places:$play_sevices_version"
implementation 'com.google.android.gms:play-services-analytics:16.0.7'
implementation 'com.taskail:simple-places-search-dialog:1.0'
implementation 'com.github.duanhong169:colorpicker:1.1.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'androidx.room:room-runtime:2.1.0-alpha04'
kapt "androidx.room:room-compiler:2.1.0-alpha04"
implementation 'androidx.paging:paging-runtime:2.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'
}
编辑:当我更新了我的项目的依赖关系,Android的工作室,并迁移它使用“androidx”一些被删除的布局文件中声明我的IDS(我不知道为什么,但我认为我的行为时,也尝试过它可能发生做清理项目,删除不必要的IDS声明),在约束布局使用的ID没有被删除。
请尝试如下
如果仍然问题仍然存在,然后只是删除应用插件:“科特林-Android平台的扩展”,同步插件的Gradle,然后我再补充它。