I had this error because I had a leading dot in the path to the test results, e.g.:
junit './build/outputs/androidTest-results/connected/flavors/DEV/*.xml'
I'm not sure why, but this fixed it:
junit 'build/outputs/androidTest-results/connected/flavors/DEV/*.xml'