Android Studio Canary 2020.3.1:Kotlin未解析引用
在将我的Android Studio Canary版本更新到3.1之后,我开始收到属于Kotlin标准库的函数的Kotlin未解析引用,这个问题似乎也影响了Android Studio导入正确库的能力 我相信我的问题与此类似。根据最近的评论,将我的gradle kotlin版本更改为1.5.0修复了“未解决的引用”问题,但compose beta06还不支持1.5.0 我想知道是否有人能解决这个问题。我相信我已经尝试过更新尽可能多的依赖项,以及清理构建、使缓存失效和重新启动 这是我的毕业档案Android Studio Canary 2020.3.1:Kotlin未解析引用,android,kotlin,android-jetpack,android-jetpack-compose,Android,Kotlin,Android Jetpack,Android Jetpack Compose,在将我的Android Studio Canary版本更新到3.1之后,我开始收到属于Kotlin标准库的函数的Kotlin未解析引用,这个问题似乎也影响了Android Studio导入正确库的能力 我相信我的问题与此类似。根据最近的评论,将我的gradle kotlin版本更改为1.5.0修复了“未解决的引用”问题,但compose beta06还不支持1.5.0 我想知道是否有人能解决这个问题。我相信我已经尝试过更新尽可能多的依赖项,以及清理构建、使缓存失效和重新启动 这是我的毕业档案 p
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.leetcards"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
useIR = true
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion '1.4.32'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
dependencies {
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.0-alpha07'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
// Navigation
def nav_version = "1.0.0-alpha10"
implementation "androidx.navigation:navigation-compose:$nav_version"
// Accompanist
def accompanist_version = "0.9.0"
// implementation "com.google.accompanist:accompanist-coil:$accompanist_version"
// Networking (Retrofit and Moshi)
def retrofit_version = "2.9.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
def moshi_kotlin_version = "1.12.0"
def moshi_converter_version = "2.9.0"
implementation "com.squareup.moshi:moshi-kotlin:$moshi_kotlin_version"
implementation "com.squareup.retrofit2:converter-moshi:$moshi_converter_version"
// Firebase
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.firebaseui:firebase-ui-auth:7.1.1'
implementation 'com.facebook.android:facebook-android-sdk:4.x'
// Facebook login
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
// CameraX core library using the camera2 implementation
def camerax_version = "1.0.0"
// The following line is optional, as the core library is included indirectly by camera-camera2
implementation "androidx.camera:camera-core:${camerax_version}"
implementation "androidx.camera:camera-camera2:${camerax_version}"
// If you want to additionally use the CameraX Lifecycle library
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
// If you want to additionally use the CameraX View class
implementation "androidx.camera:camera-view:1.0.0-alpha24"
}
升级到Kotlin 1.5.0后,我在Android Studio中的Compose项目也有同样的问题。未解决的引用似乎来自于project gradle文件中定义的Kotlin版本和与Kotlin插件捆绑的Kotlin版本之间的不匹配。在IntelliJ中有一些旧的线程描述了类似的问题: 总而言之,有两种相互冲突的情况: