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

More than one file was found with OS independent path 'lib/x86/libc++_shared.so' #52

Closed
zhouwenliang opened this issue Sep 29, 2018 · 20 comments

Comments

@zhouwenliang
Copy link

The language of MMKV

e.g. Objective-C, Swift, Java, or Kotlin

Kotlin

The version of MMKV

e.g. v1.0.10

v1.0.10

The platform of MMKV

e.g. iOS or Android

The installation of MMKV

e.g. Cocoapods, Carthage, Maven, AAR Package or Git clone

Maven

What's the issue?

Post the outputs or screenshots for errors.

Explain what you want by example or code in English.
More than one file was found with OS independent path 'lib/x86/libc++_shared.so'

@lingol
Copy link
Collaborator

lingol commented Sep 29, 2018

Google is a good tool. Use it before asking questions.

As for this issue, the very first hit by Google has an answer.

If you have a library that's adding some android .so files –like libassmidi.so or libgnustl_shared.so– you have to tell gradle to pick just one when packaging, otherwise you'll get the conflict.

android {
  packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
  }
}

@lingol
Copy link
Collaborator

lingol commented Dec 14, 2018

Now you get another choice, MMKV has a static-link version. Checkout our release note. (https://github.com/Tencent/MMKV/releases).

@ollyde
Copy link

ollyde commented Aug 8, 2019

@lingol after upgrading to AndroidX this solution doesn't seem to work anymore.

@lingol
Copy link
Collaborator

lingol commented Aug 9, 2019

@lingol after upgrading to AndroidX this solution doesn't seem to work anymore.

Try static link. com.tencent.mmkv-static:1.0.22

@calvarez-ov
Copy link

Google is a good tool. Use it before asking questions.

I googled this and Google brought me here, to this snarky comment

@lingol
Copy link
Collaborator

lingol commented Apr 2, 2020

Google is a good tool. Use it before asking questions.

I googled this and Google brought me here, to this snarky comment

Wow, that's the joke of the week in such a hard time due to the virus.

@mail2chromium
Copy link

Google is a good tool. Use it before asking questions.

As for this issue, the very first hit by Google has an answer.

If you have a library that's adding some android .so files –like libassmidi.so or libgnustl_shared.so– you have to tell gradle to pick just one when packaging, otherwise you'll get the conflict.

android {
  packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
  }
}

Not fixed for me.

@lingol
Copy link
Collaborator

lingol commented Jun 8, 2020

Google is a good tool. Use it before asking questions.
As for this issue, the very first hit by Google has an answer.

If you have a library that's adding some android .so files –like libassmidi.so or libgnustl_shared.so– you have to tell gradle to pick just one when packaging, otherwise you'll get the conflict.

android {
  packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
  }
}

Not fixed for me.

Use static-linked instead https://github.com/Tencent/MMKV/wiki/android_setup#installation

@AhmedAbuelenin
Copy link

Google is a good tool. Use it before asking questions.

As for this issue, the very first hit by Google has an answer.

If you have a library that's adding some android .so files –like libassmidi.so or libgnustl_shared.so– you have to tell gradle to pick just one when packaging, otherwise you'll get the conflict.

android {
  packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
  }
}

I added this first but didn't work but when i tried like that it worked successfully, thanks to lingol for the hint.
android{
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
}

@lingol
Copy link
Collaborator

lingol commented Mar 22, 2021

Google is a good tool. Use it before asking questions.
As for this issue, the very first hit by Google has an answer.

If you have a library that's adding some android .so files –like libassmidi.so or libgnustl_shared.so– you have to tell gradle to pick just one when packaging, otherwise you'll get the conflict.

android {
  packagingOptions {
    pickFirst 'lib/x86/libc++_shared.so'
  }
}

I added this first but didn't work but when i tried like that it worked successfully, thanks to lingol for the hint.
android{
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
}

For those who still face this problem, just use com.tencent:mmkv-static.

@egzon-mustafa
Copy link

egzon-mustafa commented Nov 3, 2021

This works for me.

android { packagingOptions { pickFirst '**/*.so' } }

@lingol
Copy link
Collaborator

lingol commented Nov 3, 2021

FYI, starting from v1.2.11, MMKV will statically link libc++ by default. It will solve this problem once and for all.
For those who still prefer a shared link of libc++.so, use com.tencent:mmkv-shared instead.

@Amina-UC-Dev
Copy link

This works for me.

android { packagingOptions { pickFirst '**/*.so' } }

yeah... its worked for me... thank u so much bro

@skydragon1115
Copy link

skydragon1115 commented Mar 19, 2022

android {
    packagingOptions {
        pickFirst '**/*.so'
    }
}

This works for me. Thanks.

@lingol
Copy link
Collaborator

lingol commented Mar 19, 2022


android {

    packagingOptions {

        pickFirst '**/*.so'

    }

}

This works for me. Thanks.

You should use mmkv-static instead. For different versions of libc++_shared.so will cause unexpected crashes.

@vaish8529
Copy link

vaish8529 commented Nov 5, 2022

Execution failed for task ':app:mergeDebugNativeLibs'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake

In app/build.gradle file

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

@lingol
Copy link
Collaborator

lingol commented Nov 5, 2022

Execution failed for task ':app:mergeDebugNativeLibs'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake

In app/build.gradle file

   packagingOptions {

    pickFirst "lib/x86/libc++_shared.so"

    pickFirst "lib/x86_64/libc++_shared.so"

    pickFirst "lib/armeabi-v7a/libc++_shared.so"

    pickFirst "lib/arm64-v8a/libc++_shared.so"

}

You should just use upgrade to mmkv 1.2.11 and above.

@vaish8529
Copy link

Execution failed for task ':app:mergeDebugNativeLibs'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake

In app/build.gradle file

   packagingOptions {

    pickFirst "lib/x86/libc++_shared.so"

    pickFirst "lib/x86_64/libc++_shared.so"

    pickFirst "lib/armeabi-v7a/libc++_shared.so"

    pickFirst "lib/arm64-v8a/libc++_shared.so"

}

You should just use upgrade to mmkv 1.2.11 and above.

how to update it?

@lingol
Copy link
Collaborator

lingol commented Nov 5, 2022

Execution failed for task ':app:mergeDebugNativeLibs'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see https://developer.android.com/studio/preview/features#automatic_packaging_of_prebuilt_dependencies_used_by_cmake

In app/build.gradle file

packagingOptions {

pickFirst "lib/x86/libc++_shared.so"
pickFirst "lib/x86_64/libc++_shared.so"
pickFirst "lib/armeabi-v7a/libc++_shared.so"
pickFirst "lib/arm64-v8a/libc++_shared.so"

}

You should just use upgrade to mmkv 1.2.11 and above.

how to update it?

What? You have not imported MMKV? Why'd you ask question here?

@vaish8529
Copy link

More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see

coz I am having this error...

More than one file was found with OS independent path 'lib/armeabi-v7a/libfbjni.so'. If you are using jniLibs and CMake IMPORTED targets, see

@Tencent Tencent locked and limited conversation to collaborators Nov 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants