在进行了一些重要的更新之后,Android开始给我有关版本号的错误,因此在修复它们的过程中,我遇到了与RXJava有关的问题,我在我的项目中使用了翻新。
我遇到的错误是。
observeOn(io.reactivex.Schedulers) in Observable cannot be applied to (rx.Scheduler)
代码 ManEmpAct.java
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.dopay.onboarding.Constants;
import com.dopay.onboarding.DoPayApplication;
import com.dopay.onboarding.R;
import com.dopay.onboarding.data.AppPreferences;
import com.dopay.onboarding.enums.StartStopAppMonitor;
import com.dopay.onboarding.fragment.CreateEmployeeDetailsFragment;
import com.dopay.onboarding.fragment.EmployeeEditFragment;
import com.dopay.onboarding.modules.UserAccountManagementView;
import com.dopay.onboarding.refactor_fragments.CountryByPhoneNumberFragment;
import com.dopay.onboarding.refactor_fragments.TakePhotoFragment;
import com.dopay.onboarding.refactor_fragments.TakePhotoFragmentCamera2;
import com.dopay.onboarding.refactor_fragments.ViewImageFragment;
import com.dopay.onboarding.util.DialogUtil;
import com.dopay.onboarding.util.EventsTracker;
import com.dopay.onboarding.util.UIUtil;
//import rx.android.schedulers.AndroidSchedulers;
import io.reactivex.android.schedulers.AndroidSchedulers;
compositeSubscription.add(publishRelay.asObservable().observeOn(AndroidSchedulers.mainThread()).subscribe(iView -> {
}
该应用程序中使用的依赖项的完整列表,以防万一我没有选择正确的依赖项 build.gradle
compileSdkVersion 28
minSdkVersion 21
targetSdkVersion 26
dependencies {
//DEPENDENCIES RELATED TO RETROFIT, RXJAVA, RXANDROID
implementation 'com.jenzz.appstate:adapter-rxjava2:3.0.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.0.0'
implementation 'com.laimiux.rxnetwork:rxnetwork:0.0.4'
//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-rxjava2:2.5.0'
implementation group: 'com.squareup.retrofit2', name: 'adapter-rxjava2', version: '2.2.0'
implementation 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
implementation 'com.jakewharton.rxrelay:rxrelay:1.1.0'
implementation group: 'io.reactivex.rxjava2', name: 'rxandroid', version: '2.0.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.4@aar'
implementation 'com.squareup.retrofit2:retrofit-mock:2.1.0'
testImplementation 'com.squareup.retrofit2:retrofit:2.1.0'
testImplementation 'com.squareup.retrofit2:converter-gson:2.1.0'
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.android.support:support-v13:28.0.0'
implementation 'com.jenzz.appstate:appstate: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.github.arimorty:floatingsearchview:2.1.1'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
debugImplementation 'com.21buttons:fragment-test-rule:1.0.0'
implementation 'frankiesardo:icepick:3.1.0'
annotationProcessor 'frankiesardo:icepick-processor:3.1.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.futuremind.recyclerfastscroll:fastscroll:0.2.5'
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.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 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'
}
渐变版本
classpath 'com.android.tools.build:gradle:3.0.1'
无法弄清楚问题出在哪里,能否请您分享一些有关我可能做错了什么的信息
谢谢 R
答案 0 :(得分:0)
您正在将rxjava 2与rxjava 1调度程序混合在一起。 rxrelay可能正在拉rxjava一个,您可以从那里意外导入调度程序-我尚未确认,但是如果是这样,您可以简单地迁移到更新的rxrelay版本。查看readme了解更多详细信息。另外请注意,这可能是其他任何库,而不是rxrelay。
无论如何,从错误的完整路径可以看出,它指出
rx.Scheduler
(rxjava1调度程序)不能用作期望io.reactivex.Schedulers
(rxjava2调度程序)的方法的参数
我强烈建议将所有库更新为rxjava2,这样您就不会再发现此问题。