错误:更改compilesdk后包rx.android.schedulers不存在

问题描述 投票:0回答:1

嗨,我更新了我的gradle和android工作室,从那时起我开始出现构建错误。

一旦我改变了compileSdkVersionto 28,我开始得到error: package rx.android.schedulers does not exist

我的构建中也出现了这个错误,如下图所示

one

这是我从build.gradle的依赖项

   dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')

    implementation 'com.android.support:multidex:1.0.2'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.jenzz.appstate:appstate:3.0.1'
    implementation 'com.jenzz.appstate:adapter-rxjava2:3.0.1'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation group: 'joda-time', name: 'joda-time', version: '2.3'
    implementation 'com.mikhaellopez:circularprogressbar:1.1.1'
    implementation 'io.realm:android-adapters:2.0.0'
    implementation 'com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.0.0'
    implementation 'com.github.arimorty:floatingsearchview:2.1.1'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
    implementation 'com.laimiux.rxnetwork:rxnetwork:0.0.4'
    // implementation 'org.opencv:opencv-android:2.4.8'
    // implementation group: 'com.github.andrejlukasevic', name: 'document-scanner', version: '4.0.0'
    // implementation 'com.mlsdev.rximagepicker:library:2.0.2'
    implementation 'com.google.firebase:firebase-messaging:15.0.0'
    debugImplementation 'com.21buttons:fragment-test-rule:1.0.0'
    //Retrofit, RxJava and OkHttp,Gson,Dagger,ButterKnife.
    implementation 'com.squareup.retrofit2:retrofit:2.1.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
    implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
    implementation 'frankiesardo:icepick:3.1.0'
    annotationProcessor 'frankiesardo:icepick-processor:3.1.0'

    implementation group: 'com.squareup.retrofit2', name: 'adapter-rxjava2', version: '2.2.0'
    implementation 'io.michaelrocks:libphonenumber-android:8.9.0'

    implementation ('com.google.dagger:dagger:2.0.2'){
        exclude group: 'com.google.guava'
    }
    annotationProcessor ('com.google.dagger:dagger-compiler:2.0.2'){
        exclude group: 'com.google.guava'
    }
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    compileOnly 'javax.annotation:jsr250-api:1.0'
    implementation 'com.android.support:support-annotations:24.2.0'
    implementation 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
    implementation 'com.jakewharton.rxrelay:rxrelay:1.1.0'
    implementation 'com.futuremind.recyclerfastscroll:fastscroll:0.2.5'
    implementation group: 'io.reactivex.rxjava2', name: 'rxandroid', version: '2.0.1'
    implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
    implementation 'com.jakewharton.timber:timber:4.5.1'
    implementation 'com.google.code.gson:gson:2.5'
    implementation 'com.squareup.retrofit2:retrofit-mock:2.1.0'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.github.fafaldo:fab-toolbar:1.2.0'
    implementation 'com.instabug.library:instabug:8.1.1'
    implementation 'com.wdullaer:materialdatetimepicker:3.5.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'net.hockeyapp.android:HockeySDK:4.1.5'
    implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
    implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar'
    implementation group: 'com.joooonho', name: 'selectableroundedimageview', version: '1.0.1'
    implementation 'com.mixpanel.android:mixpanel-android:5.+'
    debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5'
    //releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'

    testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.mockito:mockito-core:1.9.5'
    testImplementation 'com.google.dexmaker:dexmaker:1.1'
    testImplementation 'org.powermock:powermock-api-mockito:1.6.4'
    testImplementation 'org.powermock:powermock-module-junit4:1.6.4'
    testImplementation 'org.powermock:powermock-core:1.6.4'
    testImplementation 'org.powermock:powermock-module-junit4-rule:1.5.4'
    testImplementation 'org.powermock:powermock-classloading-base:1.6.4'
    testImplementation 'org.powermock:powermock-classloading-xstream:1.5.4'
    testImplementation 'org.powermock:powermock-module-testng:1.6.4'
    testImplementation 'com.squareup.retrofit2:retrofit:2.1.0'
    testImplementation 'com.squareup.retrofit2:converter-gson:2.1.0'
}

我的java文件,我收到错误

import rx.android.schedulers.AndroidSchedulers; 
@Override
    protected void onResume() {
        super.onResume();
        DoPayApplication.updateIsAppLive(Boolean.TRUE);
        publishRelay.call(StartStopAppMonitor.START_STOP_APP_MONITOR);
        compositeSubscription.add(publishRelay.asObservable().observeOn(AndroidSchedulers.mainThread()).subscribe(iView -> {

我改变了导入使用

import io.reactivex.android.schedulers.AndroidSchedulers;

这给了我这个错误

two

当我使用compileSdkVersion 26时,它没有给出关于rxAndroid / rxJava的这个错误。

这在将compileSdkVersion更改为28之后开始

我真的很困惑,请你解释一下如何解决这个问题。

谢谢R

android build.gradle rx-java2 reactivex
1个回答
0
投票

首先,当您开始使用API​​ 28时,您需要开始迁移到AndroidX

例如,更改:implementation 'com.android.support:appcompat-v7:28.0.0'

to:implementation 'androidx.appcompat:appcompat:1.0.0',我认为你的第一个错误得到修复。

© www.soinside.com 2019 - 2024. All rights reserved.