I encounter this problem only on lollipop version. I can run the app easily on versions above lollipop. The error shows up when I run the app in my application file:
If publishNonDefault true was defined in libs build.gradle, please remove it or make it false. Please try. I have resolved this issue by removing publishNonDefault true in build.gradle of lib which occurred NoClassDefFoundError.
If not working, please add
dexOptions {
preDexLibraries false
}.