OpenCC icon indicating copy to clipboard operation
OpenCC copied to clipboard

构建过程中so库命名冲突

Open 822283285 opened this issue 1 week ago • 0 comments

所用库:

// Pytorch On Android implementation 'org.pytorch:pytorch_android_lite:2.1.0' // opencc implementation "com.zqc.opencc.android.lib:lib-opencc-android:0.8.0@aar"

报错信息

2 files found with path 'lib/x86_64/libc++_shared.so' from inputs:
 - C:\Users\86156\.gradle\caches\transforms-4\01b39fc08120973004736ecef77ee8ff\transformed\pytorch_android_lite-2.1.0\jni\x86_64\libc++_shared.so
 - C:\Users\86156\.gradle\caches\transforms-4\d93e17b79b9b94bdd9f44b77ced1d033\transformed\lib-opencc-android-0.8.0\jni\x86_64\libc++_shared.so
If you are using jniLibs and CMake IMPORTED targets, see
https://developer.android.com/r/tools/jniLibs-vs-imported-targets

尝试过的解决方法

1.使用all*.exclude group: 'org.pytorch', module: 'pytorch_android_lite'方法会导致pytorch使用报错 2.使用一下方法重命名so库文件依然不可以

tasks.whenTaskAdded { task ->
        if (task.name.contains("mergeJniLibs")) {
            task.doFirst {
                def libcSharedSoFile1 = file('build/intermediates/transforms/mergeJniLibs/yourVariantDirectory/lib/arm64-v8a/libc++_shared.so')
                def libcSharedSoFile2 = file('build/intermediates/transforms/mergeJniLibs/yourVariantDirectory/lib/arm64-v8a/libc++_shared_renamed.so')
                if (libcSharedSoFile1.exists()) {
                    libcSharedSoFile1.renameTo(libcSharedSoFile2)
                    println "Renamed libc++_shared.so to libc++_shared_renamed.so"
                }
            }
        }
    }

请问有什么合适的解决方法吗,so库命名冲突,但其内容不一致,不可删除

822283285 avatar Jun 26 '24 11:06 822283285