【发布时间】:2022-01-09 13:29:13
【问题描述】:
我是 kotlin 的新手。于是我在Android Studio中创建了一个kotlin项目,并导入了Fragment-ktx和Activity-ktx依赖。因此,在片段中,当我右键单击片段然后转到->实现时,它只会打开 Fragment.java 文件。使用 Fragment-ktx 依赖项时这是正常的吗? 任何帮助都会很棒。
这是我的 app.gradle 文件
android {
compileSdkVersion 31
defaultConfig {
applicationId "com.xxxxxxx.xxxxxxxxxx"
minSdk 23
targetSdk 31
versionCode 117
versionName "3.2.11"
vectorDrawables.generatedDensities = []
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/proguard/androidx-annotations.pro'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-messaging-ktx'
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.activity:activity-ktx:1.4.0"
implementation "androidx.fragment:fragment-ktx:1.4.0"
implementation "androidx.collection:collection-ktx:1.2.0"
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.recyclerview:recyclerview:1.2.1'
implementation "androidx.preference:preference-ktx:1.1.1"
implementation "androidx.biometric:biometric-ktx:1.2.0-alpha04"
implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation 'com.android.billingclient:billing:4.0.0'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.google.android.gms:play-services-ads:20.5.0'
implementation 'com.google.android.play:core-ktx:1.8.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.nabinbhandari.android:permissions:3.8'
implementation 'com.nex3z:toggle-button-group:1.2.3'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation "io.github.iamthevoid.batteryview:batteryview:0.6.1"
}
【问题讨论】: