I have implemented project by using third party library(zxing) after implementation project is working fine then after I have written one test project to unit test my project.After running the test project ,the main project ,classes and it's methods are not giving any errors but if any zxing framework class is utilyzed within that method of the main project there getting the above error at run time not yet compile time.Please tell me how to resolve this issue?
You are getting this error because of third party library reference added two times. You have added the application path in the build path of test project. so the library reference automatically added to test project". Remove any library reference in the test project under properties->android.
FYI, click here for detail explanation.
It is because zxing jar files are being loaded twice, You must set the zxing library as "Provided" (if you are compiling your code using Maven) in compile time, so it does not add the library to your bytecode. that way you wouldn't get the error
Unfortunately, the best solution which i have seen, it's to use a script with these code lines and using Espresso v2.0:
adb shell setprop dalvik.vm.dexopt-flags v=n,o=v
adb shell stop installd
adb shell start installd
Execute it before you begin to test. It's only necessary to do it once time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With