Retrofit Okhttp在某些URL中重复斜杠

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

[我将新版本的应用程序上载到Google Play后,在某些请求URL中更新为最新版本的用户重复了斜杠。如果从手机中删除应用程序,然后从Play Market重新安装,则一切正常。我测试了两个最新版本。首先,我安装了1.0版,而在1.0版下,我安装了1.1版。之后,URL中的某些请求重复了斜杠。但是,如果仅安装最新版本,则一切正常。斜杠重复:https://www.newsasa.com/subs//dash我需要:https://www.newsasa.com/subs/dash

final RETROFIT_VERSION = '2.7.1'
implementation "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
implementation "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
implementation "com.squareup.retrofit2:adapter-rxjava2:$RETROFIT_VERSION"
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.16'
implementation 'com.squareup.okhttp3:okhttp:4.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.4.0'

    Retrofit provideRetrofit(OkHttpClient okHttpClient, GsonConverterFactory gsonConverterFactory) {
        return new Retrofit.Builder()
                .baseUrl(https://mydomainname.com)
                .client(okHttpClient)
                .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                .addConverterFactory(gsonConverterFactory)
                .build();
    }

    @GET("/subscriptions/{account}/offers/{lang}")
    Observable<List<Offer>> getOffers(@Path("account") String account, @Path("lang") String lang);
android retrofit okhttp
1个回答
0
投票

我发现了我的错误。我传递了空字符串。这不是重复的斜杠。

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