![](/img/trans.png)
[英]Kotlin Scope Functions not resolved in android studio
[英]Kotlin Scope functions not working in Android studio
無法在 android 工作室中使用 kotlin scope 函數,顯示未解決的參考。 工作室版:北極狐2020.3.1補丁4
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
def HILT_VERSION ="2.38.1"
def NAV_VERSION = "2.3.5"
def RETROFIT_VERSION = "2.9.0"
def OKHTTP_VERSION = "4.9.0"
android {
compileSdk 31
defaultConfig {
applicationId "com.example.ezcart"
minSdk 21
targetSdk 31
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'
}
dataBinding {
enabled true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "com.google.dagger:hilt-android:$HILT_VERSION"
kapt "com.google.dagger:hilt-android-compiler:$HILT_VERSION"
implementation "androidx.navigation:navigation-fragment-ktx:$NAV_VERSION"
implementation "androidx.navigation:navigation-ui-ktx:$NAV_VERSION"
implementation "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
// Retrofit with Gson Converter
implementation "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
implementation 'com.google.code.gson:gson:2.8.9'
implementation "com.squareup.okhttp3:okhttp:$OKHTTP_VERSION"
implementation "com.squareup.okhttp3:logging-interceptor:$OKHTTP_VERSION"
//Glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
要使用Kotlin函數,包括Scope 函數,請添加依賴項:
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
這是Kotlin 標准庫,它通過Kotlin為日常工作提供生活必需品。 這些包括:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.