I have a java module in my Android Studio project that is a dependency of an Android module. I am having problems on build with the following exception appearing.
So I have found the solution at this blog post.
The trick is in your Java Library module's build.gradle file you need to include the following.
apply plugin: 'java' sourceCompatibility = 1.6 targetCompatibility = 1.6
This will then work.