无法解析方法 'subscribe(io.reactivex.rxjava3.core.SingleObserver<okhttp3.ResponseBody>)'

Cannot resolve method 'subscribe(io.reactivex.rxjava3.core.SingleObserver<okhttp3.ResponseBody>)'

SingleObserver < ResponseBody > singleObserver = new SingleObserver < ResponseBody > () {
    @Override
    public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {
        Log.w("ABC", "S");
    }

    @Override
    public void onSuccess(@io.reactivex.rxjava3.annotations.NonNull ResponseBody responseBody) {
        try {
            Log.w("ABC", responseBody.string());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onError(@io.reactivex.rxjava3.annotations.NonNull Throwable e) {
        Log.w("ABC", e.getMessage());
    }
};
RetrofitInterface retrofitInterface = new Retrofit.Builder().baseUrl(Constants.BASE_URL).addCallAdapterFactory(RxJava3CallAdapterFactory.create()).build().create(RetrofitInterface.class);
retrofitInterface.getMainData(1).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribe(singleObserver); //The Error Here

我正在尝试将 SingleObserver 与 subscribe 方法一起使用,但出现此错误。

错误

Cannot resolve method 'subscribe(io.reactivex.rxjava3.core.SingleObserver<okhttp3.ResponseBody>)'

我解决了问题:从界面将其从 Observable< ResponseBody > 更改为 Single< ResponseBody >