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 projec
I changed test project setting in Intelij Idea. Go to Modules -> Dependencies, then set scope of the tested project to 'Provided'.
I have this error sometimes. Just the build->clean project helped me
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 do not specifically need a device with low API version (<=19), you can leave transitive dependencies and create an emulator with higher API version.
This happens only on devices which API is lower than Lollipop (API 21). Running tests on emulators higher/equal to API 21 runs normally, without issues.
Uncheck the jars (in my case maps and google play services jar) from "Order and Export" tab under Project's Java build path in Eclipse.But let them be added in "Libraries" tab. Click OK, Clean projects and build now. It works.