I am working with Android Studio 3.1 Canary 6 and I am getting this error when I build my project. I search this error and many users get this with different reasons, but I did
Check Unit Tests. Run all gradle tasks step by step..
maybe this can help, as this worked for me, just delete the taskhistory.bin file in (projectFolder)/.gradle/4.1/taskHistory and clean and rebuild the project. best of luck!
I found the problem. There is an error in my code, but Android Studio don`t show me errors in code, for studio everything is fine. When I look to step by step task execution of gradle, I saw the problems.
Just search and fix for all Erros described in Java Compiler
Its smart answer is that there is some syntax error in your Code may be in Java file or XML. Fix them first. Error will gone. work 100 percent for me every time