在华为mate20 android10系统反射不到setApplicationProtocols 类,是9.0 API限制吗,有什么解决办法
com.android.org.conscrypt.Java8EngineWrapper.setApplicationProtocols [class [Ljava.lang.String;] java.lang.NoSuchMethodException: com.android.org.conscrypt.Java8EngineWrapper.setApplicationProtocols [class [Ljava.lang.String;] at java.lang.Class.getMethod(Class.java:2072) at java.lang.Class.getDeclaredMethod(Class.java:2050) at com.github.megatronking.netbare.http.HttpSSLResponseCodec.enableJava8EngineWrapperAlpn(HttpSSLResponseCodec.java:110) at com.github.megatronking.netbare.http.HttpSSLResponseCodec.enableAlpn(HttpSSLResponseCodec.java:94) at com.github.megatronking.netbare.http.HttpSSLResponseCodec.createEngine(HttpSSLResponseCodec.java:62) at com.github.megatronking.netbare.ssl.SSLResponseCodec.prepareHandshake(SSLResponseCodec.java:86) at com.github.megatronking.netbare.http.HttpSSLResponseCodec.prepareHandshake(HttpSSLResponseCodec.java:87) at com.github.megatronking.netbare.http.HttpSSLCodecInterceptor.intercept(HttpSSLCodecInterceptor.java:97) at com.github.megatronking.netbare.http.HttpSSLCodecInterceptor.intercept(HttpSSLCodecInterceptor.java:38) at com.github.megatronking.netbare.gateway.IndexedInterceptor.intercept(IndexedInterceptor.java:67) at com.github.megatronking.netbare.http.HttpRequestChain.processNext(HttpRequestChain.java:55) at com.github.megatronking.netbare.http.HttpRequestChain.processNext(HttpRequestChain.java:32) at com.github.megatronking.netbare.gateway.InterceptorChain.process(InterceptorChain.java:104) at com.github.megatronking.netbare.http.HttpSniffInterceptor.intercept(HttpSniffInterceptor.java:68) at com.github.megatronking.netbare.http.HttpSniffInterceptor.intercept(HttpSniffInterceptor.java:35) at com.github.megatronking.netbare.gateway.IndexedInterceptor.intercept(IndexedInterceptor.java:67) at com.github.megatronking.netbare.http.HttpRequestChain.processNext(HttpRequestChain.java:55) at com.github.megatronking.netbare.http.HttpRequestChain.processNext(HttpRequestChain.java:32) at com.github.megatronking.netbare.gateway.InterceptorChain.process(InterceptorChain.java:104) at com.github.megatronking.netbare.http.HttpVirtualGateway.onSpecRequest(HttpVirtualGateway.java:121) at com.github.megatronking.netbare.gateway.SpecVirtualGateway.onRequest(SpecVirtualGateway.java:69) at com.github.megatronking.netbare.NetBareVirtualGateway.onRequest(NetBareVirtualGateway.java:88) at com.github.megatronking.netbare.tunnel.TcpVATunnel$1.onRead(TcpVATunnel.java:90) at com.github.megatronking.netbare.tunnel.NioTunnel.onRead(NioTunnel.java:101) at com.github.megatronking.netbare.proxy.TcpProxyServer.process(TcpProxyServer.java:141) at com.github.megatronking.netbare.proxy.BaseProxyServer.run(BaseProxyServer.java:62) at com.github.megatronking.netbare.proxy.TcpProxyServer.run(TcpProxyServer.java:110) at java.lang.Thread.run(Thread.java:929)
对应代码: private void enableJava8EngineWrapperAlpn() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { Method setApplicationProtocolsMethod = mSSLEngine.getClass().getDeclaredMethod( "setApplicationProtocols", String[].class); setApplicationProtocolsMethod.setAccessible(true); String[] protocols = new String[mClientAlpns.length]; for (int i = 0; i < protocols.length; i++) { protocols[i] = mClientAlpns[i].toString().toLowerCase(); } setApplicationProtocolsMethod.invoke(mSSLEngine, new Object[]{protocols});
Method setUseSessionTicketsMethod = mSSLEngine.getClass().getDeclaredMethod(
"setUseSessionTickets", boolean.class);
setUseSessionTicketsMethod.setAccessible(true);
setUseSessionTicketsMethod.invoke(mSSLEngine, true);
}
I also hit the same problem ,any solution ?