Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated *.so resources #400

Open
kannabi opened this issue Oct 26, 2022 · 5 comments
Open

Duplicated *.so resources #400

kannabi opened this issue Oct 26, 2022 · 5 comments

Comments

@kannabi
Copy link

kannabi commented Oct 26, 2022

Describe the issue
I have a problem with native lib merge. I have two modules: opencv and another one that use opencv.
image
I connect opencv dependencies by cmake at second module like this

include_directories(${OpenCV_DIR}/native/jni/include)
add_library(lib_opencv SHARED IMPORTED)
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${OpenCV_DIR}/native/libs/${ANDROID_ABI}/libopencv_java4.so)

target_link_libraries(nativelib lib_opencv log)

Where nativelib is current module lib

How can I merge this two dependencies?

Build Environment

  • Operating System: MacOS
  • Gradle Version: 7.2.2
  • Fat-aar Version: 1.3.8
@kannabi kannabi changed the title Duplicated so resources Duplicated *.so resources Oct 27, 2022
@zhanlan123
Copy link

请在build.gradle中使用下面类似的代码排除

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

@kllkko
Copy link

kllkko commented Mar 21, 2023

没有作用

@zj8331182
Copy link

zj8331182 commented Mar 29, 2023

anyone fix this issue? i have the same problem

@lucifer-kave
Copy link

这个有办法解决吗?

@lucifer-kave
Copy link

我这边的解决方案是:
在打包的时候把冲突的库先exclude,然后在compileOnly添加进来。看起来是能用,但是不确定对所有情况都适用。
embed("abcde:gfh:0.1") {
transitive = false
exclude group: "111111", module: "22222"
exclude group: "3333", module: "4444"
}
compileOnly("111111:22222:0.2")
compileOnly("3333:4444:0.2")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants