这是我的项目,我正在尝试使用这个rxjava库。在开始时,我添加了所需的依赖项--它是同步的,没有任何错误--但是当我重新构建项目时,它没有工作。这是我的构建级:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs.kotlin'
id 'kotlin-kapt'
id 'kotlin-android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.cerentekin.countrylist"
minSdk 23
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled = true
}
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'
}
}
dependencies {
def lifeCycleExtensionVersion = '1.1.1'
def supportVersion = '28.0.0'
def retrofitVersion = '2.9.0'
def glideVersion = '4.12.0'
def rxJavaVersion = '2.2.20'
def roomVersion = '2.4.2'
def navVersion = '2.4.1'
def preferencesVersion = '1.2.0'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "android.arch.lifecycle:extensions:$lifeCycleExtensionVersion"
//noinspection GradleCompatible
implementation "com.android.support:palette-v7:$supportVersion"
//noinspection GradleCompatible
implementation "com.android.support:design:$supportVersion"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxJavaVersion"
implementation "androidx.room:room-runtime:$roomVersion"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
kapt "androidx.room:room-compiler:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
implementation "androidx.navigation:navigation-fragment-ktx:$navVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navVersion"
implementation "androidx.preference:preference:$preferencesVersion-ktx"
implementation "com.google.android.material:material:1.5.0"
}
我第一次尝试了rxjava库,但是项目没有同步,“无法找到io.reactivex.rxjava 2:rxandroid:2.2.20”。这就是我的错。
https://stackoverflow.com/questions/71643686
复制相似问题