我在 android studio 中创建了一个新项目并添加了所有依赖项。它们都是最新的。当我构建项目时,我收到了这些警告。应用程序中没有代码。这些在我添加依赖项后开始显示。
我应该就这样离开吗?
Sync output
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
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'
}
buildFeatures {
viewBinding = true
}
}
dependencies {
def version_nav = "2.3.4"
def lifecycle_version = "2.3.0"
def version_retrofit_coroutines_adapter = "0.9.2"
def version_kotlin_coroutines = "1.3.9"
def version_moshi = "1.9.2"
def retrofit ="2.9.0"
def hilt_version = "2.31-alpha"
def hilt_viewmodels = "1.0.0-alpha03"
def fragment_ktx = "1.3.1"
def okhttp = "4.9.0"
def moshi_converter = "2.8.1"
def recycler_view_version = "1.2.0-beta02"
def timber_version = "4.7.1"
def java_poet_version = "1.13.0"
def coil_version = "1.1.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
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.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// Timber
implementation "com.jakewharton.timber:timber:$timber_version"
implementation "com.squareup.retrofit2:retrofit:$retrofit"
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
// Moshi
implementation "com.squareup.moshi:moshi:$version_moshi"
implementation "com.squareup.moshi:moshi-kotlin:$version_moshi"
implementation "com.squareup.retrofit2:converter-moshi:$moshi_converter"
// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$version_nav"
implementation "androidx.navigation:navigation-ui-ktx:$version_nav"
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version_kotlin_coroutines"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version_kotlin_coroutines"
// Retrofit Coroutines Support
implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:$version_retrofit_coroutines_adapter"
//RecyclerView
implementation "androidx.recyclerview:recyclerview:$recycler_view_version"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Lifecycle only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
//OkHttp3
implementation"com.squareup.okhttp3:okhttp:$okhttp"
//Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
//Hilt View models
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_viewmodels"
kapt "androidx.hilt:hilt-compiler:$hilt_viewmodels"
//Fragments
implementation "androidx.fragment:fragment-ktx:$fragment_ktx"
//Java Poet
kapt "com.squareup:javapoet:$java_poet_version"
//Coil
implementation "io.coil-kt:coil:$coil_version"
}
kapt {
correctErrorTypes true
}
该应用程序运行没有任何问题,但因为这是我第一次看到的警告。我在其他任何地方都找不到任何相关的东西,想知道为什么会这样。
最佳答案
我遇到了同样的问题,结果发现 buildToolsVersion "30.0.3"
used 没有安装,所以我切换到已安装的buildToolsVersion "29.0.3"
(在我的情况下)并且警告消失了。
关于Android构建警告将新ns映射到旧ns,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66722945/