card-io / card.io-Android-SDK

card.io provides fast, easy credit card scanning in mobile apps
Other
1.99k stars 535 forks source link

More than one file was found with OS independent path 'lib/armeabi-v7a/libcardioDecider.so #186

Closed lantian699 closed 7 years ago

lantian699 commented 7 years ago

General information

Issue description

I had this error when running app in Android Studio, complile is pass. I can't understand why this error appears. And I found nothing in Internet for the similar error when using card.io. perhaps this is particular for my project due to different dependencies I used.

image

lantian699 commented 7 years ago

no one answer my question, I finally found that it is due to incompatibilities with Reach5 library.

lkorth commented 7 years ago

Would you mind sharing the incompatibilities you ran into for anyone else that may run into this issue?

lantian699 commented 7 years ago

I don't have further information for this issue, I just test every library listed in my gradle file to verify which one can cause the conflict with card.io. finally that is reachFive (https://reachfive.co/en/) which we use to connect our app with social account. I'm working on it and i will go back here to post my solution if I could try to figure out.

lantian699 commented 7 years ago

Since two weeks I'm stuck in it, finally I figure out the source of problem. It is because that ReachFive Library (a library used in my project)has include an old version of CARD.IO for his PAYPAL service. So I found the exactly same .so file in his AAR. and my solution is brutal, I use winRAR to open directly its AAR library and delete JNI file completely for 2 reason below:

  1. The application needs just one set of .so file (needed for Card.IO) in JNI path, if two libraries contain the same .so files, it will create conflict obviously.
  2. We dont use the PAYPAL service provided in ReachFive Library. And even though we need it, I think its old Card.IO can also use this new version .so file, it depends on the compatibility I dont verify this point.

I have another solution which can simply eliminate this kind of error in order to build successfully the project. add this in gradle file:

packagingOptions { exclude "lib/armeabi-v7a/libcardioDecider.so" exclude "lib/armeabi-v7a/libcardioRecognizer.so" exclude "lib/armeabi-v7a/libopencv_imgproc.so" exclude "lib/armeabi-v7a/libcardioRecognizer_tegra2.so" exclude "lib/armeabi-v7a/libopencv_core.so" exclude "lib/armeabi/libcardioDecider.so" exclude "lib/mips/libcardioDecider.so" exclude "lib/x86/libcardioDecider.so" }

But this solution is not perfect, it will exclude all .so file mentioned above. then neither ReachFive nor Card.IO can access into his so file, Card.IO will not start camera. I wonder that why in this method "packagingOptions" I cannot define a scope that my rules will applied for?

Alright, at least it works !

AndroPlus commented 6 years ago

This one also will help.. https://stackoverflow.com/a/44962630/1237175

chavantr commented 6 years ago

check with your lib folder might be having same aar/jar file in double in with different name.

zakreya commented 6 years ago

Error:Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.

More than one file was found with OS independent path 'lib/armeabi-v7a/libopencv_java3.so' i want delete this path becuse conflict with file orginal im use code in gredl packagingOptions{ exclude 'lib/armeabi-v7a/libopencv_java3.so'

}

but not success ... plz help me

Saturdaycong commented 6 years ago

I have a similar problem, read your issue, I have solved my problem. thank you

pkjvit commented 6 years ago

I have got the same issue file lib/x86_64/libsqlcipher.so found more thane once and found out the solution. This happens due to the same file coming multiple times in dependencies or modules.

Fixed by adding following code in app build.gradle file inside android block


android {
   ---
   packagingOptions {
        pickFirst 'lib/x86_64/libsqlcipher.so'
        pickFirst 'lib/armeabi/libsqlcipher.so'
        pickFirst 'lib/x86/libsqlcipher.so'
        pickFirst 'lib/armeabi-v7a/libsqlcipher.so'
        pickFirst 'lib/arm64-v8a/libsqlcipher.so'
    }
   ---
}
iadcg commented 5 years ago

@pkjvit Thanks mate. it worked! =)