The new SDK seems to be using OkHttp 5.3.1, while React Native (and other SDKs we use like Stripe Terminal) use OkHttp 4.x
The first consequence is this build failure:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
> 2 files found with path 'META-INF/versions/9/OSGI-INF/MANIFEST.MF' from inputs:
- com.squareup.okhttp3:logging-interceptor:5.3.1/logging-interceptor-5.3.1.jar
- org.jspecify:jspecify:1.0.0/jspecify-1.0.0.jar
Adding a packaging block may help, please refer to
https://developer.android.com/reference/tools/gradle-api/com/android/build/api/dsl/Packaging
for more information
And if adding it to pickFirst makes the build succeed, various network requests fail for various reasons, e.g.
StripeTerminal: java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Util;
StripeTerminal: at okhttp3.tls.HandshakeCertificates$Builder.build(HandshakeCertificates.kt:174)
StripeTerminal: Caused by: java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Util"
To fix it, I had to add these to android/app/build.gradle (through an Expo plugin since we use Expo) to force the use of OkHttp 4.12:
dependencies {
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
implementation("com.squareup.okhttp3:okhttp-urlconnection")
implementation("com.squareup.okhttp3:okhttp-tls")
// ...
}
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.squareup.okhttp3') {
details.useVersion '4.12.0'
}
}
}
The new SDK seems to be using OkHttp 5.3.1, while React Native (and other SDKs we use like Stripe Terminal) use OkHttp 4.x
The first consequence is this build failure:
And if adding it to
pickFirstmakes the build succeed, various network requests fail for various reasons, e.g.To fix it, I had to add these to
android/app/build.gradle(through an Expo plugin since we use Expo) to force the use of OkHttp 4.12: