Skip to content

Commit cbd5e05

Browse files
authored
fix(android): OkHttp causes crash on startup when target API level 30+ (#1634)
1 parent 9ed0a83 commit cbd5e05

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

android/dependencies.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,16 @@ static int toVersionNumber(String version) {
6868
ext {
6969
apply(from: "${buildscript.sourceFile.getParent()}/test-app-util.gradle")
7070

71+
reactNativeVersion = getPackageVersionNumber("react-native", rootDir)
72+
7173
compileSdkVersion = 34
7274
minSdkVersion = 23
73-
targetSdkVersion = 33
7475

75-
reactNativeVersion = getPackageVersionNumber("react-native", rootDir)
76+
// A bug in an older version of OkHttp causes it to throw 'expected Android
77+
// API level 21+ but was 33'.
78+
// TODO: Remove when we drop support for 0.64
79+
targetSdkVersion = reactNativeVersion > 0 && reactNativeVersion < 6500 ? 29 : 33
80+
7681
autodetectReactNativeVersion = reactNativeVersion == 0 || reactNativeVersion >= 7100
7782
enableNewArchitecture = isNewArchitectureEnabled(project)
7883
usePrefabs = reactNativeVersion == 0 || reactNativeVersion >= 7100

0 commit comments

Comments
 (0)