Skip to content

Android build fails on Expo 54 RN0.81 project with new arch enabled - customer-io SDK version 6.1.0 or greater #561

@ryan-case-ml

Description

@ryan-case-ml

SDK version: 6.1.1 (but confirmed occurring on 6.1.0 as well)

Environment: Development

Error during build

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 3 files found with path 'META-INF/versions/9/OSGI-INF/MANIFEST.MF' from inputs:
      - com.squareup.okhttp3:logging-interceptor:5.2.1/logging-interceptor-5.2.1.jar
      - com.squareup.okhttp3:okhttp-sse:5.2.1/okhttp-sse-5.2.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

To Reproduce

  1. Clone this gist - https://gist.github.com/ryan-case-ml/c1a2fc476eb5f70ec2020e0525feeeee
  2. npm i
  3. npm run prebuild - the android, ios and .expo folders should get generated
  4. npm run android

Expected behavior
Build should succeed with no errors

Additional context
I found that by downgrading to sdk 6.0.0 it would resolve the failures.

Attempting to use expo-build-properties to modify the build.gradle file to handle duplicate metadata files will allow the build to succeed, but then the app will crash due to missing okhttp version 4 classes expected by react-native. This is likely because pulling in okhttp5 with the newest customer-io sdk forces the build to install that version for all dependencies in the project.

java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/internal/Util;
  okhttp3.JavaNetCookieJar.decodeHeaderAsJavaNetCookies(JavaNetCookieJar.kt:81)
  okhttp3.JavaNetCookieJar.loadForRequest(JavaNetCookieJar.kt:59)
  com.facebook.react.modules.network.ReactCookieJarContainer.loadForRequest(ReactCookieJarContainer.kt:37)
  okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:75)
  okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
  okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:74)
  okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
  okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:208)
  okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:529)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
  java.lang.Thread.run(Thread.java:1012)
Caused by java.lang.ClassNotFoundException: Didn't find class "okhttp3.internal.Util" on path: DexPathList[[zip file "/data/app/~~kukusUcxl3iCxZYzZvP6xA==/com.lcard_app-MAms_GWeV1S1ztzEWxb1fg==/base.apk"],nativeLibraryDirectories=[/data/app/~~kukusUcxl3iCxZYzZvP6xA==/com.lcard_app-MAms_GWeV1S1ztzEWxb1fg==/lib/arm64, /data/app/~~kukusUcxl3iCxZYzZvP6xA==/com.lcard_app-MAms_GWeV1S1ztzEWxb1fg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
  dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
  java.lang.ClassLoader.loadClass(ClassLoader.java:379)
  java.lang.ClassLoader.loadClass(ClassLoader.java:312)
  okhttp3.JavaNetCookieJar.decodeHeaderAsJavaNetCookies(JavaNetCookieJar.kt:81)
  okhttp3.JavaNetCookieJar.loadForRequest(JavaNetCookieJar.kt:59)
  com.facebook.react.modules.network.ReactCookieJarContainer.loadForRequest(ReactCookieJarContainer.kt:37)
  okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:75)
  okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
  okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:74)
  okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:126)
  okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:208)
  okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:529)
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
  java.lang.Thread.run(Thread.java:1012)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions