小编Ank*_*kur的帖子

OkHttp SSLHandshakeException SSL握手中止SSL库中的失败,协议错误

04-23 17:17:38.434 21599-21956/ D/NativeCrypto: ssl=0x0 NativeCrypto_SSL_interrupt
04-23 17:17:38.435 21599-21956/ D/OkHttp: <-- HTTP FAILED: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x635d8808: Failure in SSL library, usually a protocol error
    error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:744 0x5e6c46fd:0x00000000)
Run Code Online (Sandbox Code Playgroud)

Android较低版本的设备(4.1 - 4.4)给出了SSL错误.以前版本适用于以下版本:

implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.9.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'

implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
Run Code Online (Sandbox Code Playgroud)

但升级这些库后,事情就会发生变化 每个服务调用都会提供SSL握手异常.

implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'

implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.4.0'
Run Code Online (Sandbox Code Playgroud)

此外,如果我将这些库降级到以前的版本,它仍然无法正常工作.但git checkout到上一次提交工作正常.懵懵懂懂.

android retrofit okhttp retrofit2 okhttp3

7
推荐指数
2
解决办法
6989
查看次数

RecyclerView适配器getItemViewType方法有时返回2,8等等而不是0或1

以下是我使用的代码:

public class PaymentAndReceiptAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    private static final int TYPE_HEADER = 0;
    private static final int TYPE_ITEM = 1;

    public Context context;
    private List<CustomerAndAmount> customerAndAmountList = new ArrayList<>();
    private PaymentAndReceiptItemClickListener paymentAndReceiptItemClickListener;
    private Map<Long, Double> chartMap;

    public PaymentAndReceiptAdapter(final Context context, final List<CustomerAndAmount> customerAndAmountList, final Map<Long, Double> chartMap, final PaymentAndReceiptItemClickListener paymentAndReceiptItemClickListener) {
        this.context = context;
        setResult(customerAndAmountList, chartMap);
        this.paymentAndReceiptItemClickListener = paymentAndReceiptItemClickListener;
    }

    public void setResult(final List<CustomerAndAmount> customerAndAmountList, final Map<Long, Double> chartMap) {
        this.customerAndAmountList.clear();
        if (null != customerAndAmountList) {
            this.customerAndAmountList.addAll(customerAndAmountList);
        }
        this.chartMap …
Run Code Online (Sandbox Code Playgroud)

android recycler-adapter android-recyclerview recyclerview-layout

5
推荐指数
0
解决办法
367
查看次数

使用RealmMigration在Realm Android中将数据类型从String更改为Long

final RealmObjectSchema customerSchema = schema.get("Customer");
customerSchema.removeField("creditPeriod")
    .addField("creditPeriod", Long.class);
Run Code Online (Sandbox Code Playgroud)

以上是我用于领域迁移的代码.我删除了以前字符串已经存在的字段,然后在迁移代码和Pojo.class中添加了相同的字段更改其数据类型

android type-conversion realm realm-migration

3
推荐指数
1
解决办法
2088
查看次数

从必需变量到可空值的领域迁移

从必需变量到可空值的领域迁移

我在以前的领域版本中有一个变量,它是必填字段。但是对于较新的版本,我希望它不是必需的,而是可以为空的版本。如何通过领域迁移做到这一点?

android realm realm-migration realm-mobile-platform

1
推荐指数
1
解决办法
902
查看次数