Не удалось найти классы androidx из метода createBestAvailableBackgroundScheduler - Android - PullRequest
1 голос
/ 07 января 2020

Я использую от androidx в моем проекте, но когда я запускаю его на android 4.3, выведите меня ниже:

Could not find class 'androidx.work.impl.background.systemjob.SystemJobService', referenced from method androidx.work.impl.Schedulers.createBestAvailableBackgroundScheduler
Could not find class 'androidx.work.impl.constraints.trackers.NetworkStateTracker$NetworkStateCallback', referenced from method androidx.work.impl.constraints.trackers.NetworkStateTracker.<init>
Could not find class 'java.lang.invoke.MethodHandles$Lookup', referenced from method retrofit2.Platform.invokeDefaultMethod

А вот мой gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "kotlin-kapt"
android {
    compileSdkVersion 29
    buildToolsVersion '29.0.2'
    defaultConfig {
        applicationId "xxx.xxx"
        minSdkVersion 17
        targetSdkVersion 29
        renderscriptTargetApi 17
        renderscriptSupportModeEnabled true
        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
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.squareup.retrofit2:retrofit:2.7.1'
    implementation 'com.squareup.retrofit2:converter-gson:2.7.1'
    implementation 'com.jakewharton:butterknife:10.2.1'
    implementation 'com.squareup.okhttp3:okhttp:4.3.0'
    kapt 'com.jakewharton:butterknife-compiler:10.2.1'
    implementation 'com.google.dagger:dagger:2.25.4'
    implementation 'com.google.dagger:dagger-android-support:2.25.4'
    implementation 'com.google.dagger:dagger-android:2.25.4'
    kapt 'com.google.dagger:dagger-compiler:2.25.4'
    kapt 'com.google.dagger:dagger-android-processor:2.25.4'
    implementation 'androidx.room:room-runtime:2.2.3'
    kapt 'androidx.room:room-compiler:2.2.3'
    kapt "android.arch.persistence.room:compiler:2.2.2"
    implementation 'androidx.room:room-ktx:2.2.3'
    implementation 'androidx.room:room-rxjava2:2.2.3'
    implementation 'androidx.room:room-guava:2.2.3'
    implementation 'com.squareup.retrofit2:converter-scalars:2.7.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
    implementation 'com.netflix.rxjava:rxjava-android:0.20.7'
    def lifecycle_version = "2.1.0"
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0-rc03"
    implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0-rc03"
    implementation "androidx.work:work-runtime-ktx:2.2.0"
    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
}

А вот и мой activity:

class CoursesActivity : DaggerAppCompatActivity()...{
    override fun onCreate(savedInstanceState: Bundle?) {
        super<DaggerAppCompatActivity>.onCreate(savedInstanceState)
        lifecycle.addObserver(this)
        setContentView(R.layout.activity_courses)
     }
}

1 Ответ

0 голосов
/ 08 января 2020

Решил мою проблему, я отредактировал следующие библиотеки:

implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.3'
...