Fixing libc++_shared.so conflicts

Issue

Your project’s libc++_shared.so conflicts with the RC SDK’s version during compilation.

Error stack:

2 files found with path 'lib/arm64-v8a/libc++_shared.so' from inputs: 
 - /{path1}/jni/arm64-v8a/libc++_shared.so  
 - /{path2}/transformed/jetified-im_libcore-5.x.x/jni/arm64-v8a/libc++_shared.so

path1 and path2 show where the conflict occurs—both your project and the RC SDK include libc++_shared.so.

Solutions

Solution 1

  1. Remove libc++_shared.so from your project.

  2. Add this to build.gradle to deduplicate:

       packagingOptions {
            pickFirst('lib/armeabi-v7a/libc++_shared.so')
            pickFirst('lib/arm64-v8a/libc++_shared.so')
            pickFirst('lib/x86/libc++_shared.so')
            pickFirst('lib/x86_64/libc++_shared.so')
        }
    

Solution 2 (for SDK versions 5.6.1+)

Use this if the RC SDK’s libc++_shared.so doesn’t meet your project’s needs.

Exclude libc++_shared.so when adding the RC SDK dependency:

implementation ("cn.rongcloud.sdk:im_lib:x.y.z")  { 
 exclude group: 'cn.rongcloud.sdk', module: 'cpp_shared'
}

// Skip this if you’re not using the Kit SDK
implementation ("cn.rongcloud.sdk:im_kit:x.y.z")  { 
 exclude group: 'cn.rongcloud.sdk', module: 'cpp_shared'
}

Need help?

submit a ticket if you have questions.