1

My build fails when attempting to run my react native project in android. The error shows that '2 files found with path lib/x86/libc++_shared.so'. Do you know what may be causing this and how I can possibly fix this issue? I tried removing the file in the .gradle cache directory but this didn't help. I have had a look at the answer from the link More than one file was found with OS independent path 'lib/x86/libusb.so' . However, I am not sure where I remove jniLibs.srcDir 'src/main/libs' code inside sourceSets.main block. Can you please assist? Really new to using android for running react native projects.

enter image description here

Thanks.

AJDee
  • 147
  • 1
  • 14
  • Check this https://stackoverflow.com/questions/51943269/more-than-one-file-was-found-with-os-independent-path-lib-armeabi-libbugly-so - make sure you understand what the issue is – OldFart Oct 17 '22 at 11:36
  • Thanks for the response. I also tried this answer too, placing the packagingOptions block in the ...android/build.gradle file but got the error 'Could not find method android() for arguments'. This error I believe is due to placing the block in the wrong build.gradle but I'm not sure which build.gradle file I should add the block to. Adding it to android/app/build.gradle file also gave me the same duplicate error above. – AJDee Oct 17 '22 at 18:05
  • Can someone please help here? In which build.gradle file do I add the packagingOptions block? – AJDee Oct 18 '22 at 06:48
  • You've specified the same library to be packed twice. Once by linking it to your library in CMake and once by putting it in the jniLibs directory. CMake IMPORTED targets and jniLibs both refer to the same library. You must bave only one reference to it so its packaged once. – OldFart Oct 25 '22 at 08:05
  • Check this https://stackoverflow.com/a/58602329/7120073 – OldFart Oct 25 '22 at 08:06
  • Does this answer your question? [More than one file was found with OS independent path 'lib/x86/libusb.so'](https://stackoverflow.com/questions/44954122/more-than-one-file-was-found-with-os-independent-path-lib-x86-libusb-so) – OldFart Oct 25 '22 at 08:07

0 Answers0