mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Android: upgrading to OkHttp from v3 to v4 (#31084)
Summary: Extends https://github.com/facebook/react-native/pull/30694 to fix tests. OkHttp v4 was released almost a year ago. Even though v3 is still receiving security and bug fixes, most of the new improvements and features are landing in v4. This PR bumps OkHttp from v3 to v4 and addresses backward-incompatible changes. Side effects of this upgrade: - OkHttp v4 depends on Kotlin's standard library, so react-native will have a transitive dependency on it. - The dex method count of test apk has exceeded the maximum, so multidexing had to be enabled for android tests. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Changed] - Bumping OkHttp from v3 to v4. Pull Request resolved: https://github.com/facebook/react-native/pull/31084 Test Plan: Automated (relying on the test suite) and manual testing. Reviewed By: fkgozali Differential Revision: D27597430 Pulled By: ShikaSD fbshipit-source-id: 967379b41c2bcd7cfd4083f65059f5da467b8a91
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0b8731d40d
commit
8207e97f91
+1
-18
@@ -10,8 +10,6 @@ package com.facebook.react.modules.network;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
@@ -62,13 +60,7 @@ public class OkHttpClientProvider {
|
||||
.writeTimeout(0, TimeUnit.MILLISECONDS)
|
||||
.cookieJar(new ReactCookieJarContainer());
|
||||
|
||||
try {
|
||||
Class ConscryptProvider = Class.forName("org.conscrypt.OpenSSLProvider");
|
||||
Security.insertProviderAt((Provider) ConscryptProvider.newInstance(), 1);
|
||||
return client;
|
||||
} catch (Exception e) {
|
||||
return enableTls12OnPreLollipop(client);
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
public static OkHttpClient.Builder createClientBuilder(Context context) {
|
||||
@@ -88,13 +80,4 @@ public class OkHttpClientProvider {
|
||||
|
||||
return client.cache(cache);
|
||||
}
|
||||
|
||||
/*
|
||||
On Android 4.1-4.4 (API level 16 to 19) TLS 1.1 and 1.2 are
|
||||
available but not enabled by default. The following method
|
||||
enables it.
|
||||
*/
|
||||
public static OkHttpClient.Builder enableTls12OnPreLollipop(OkHttpClient.Builder client) {
|
||||
return client;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user