Android compile error; Java plugin has been applied, not compatible with android

The problem is that you cannot apply both the com.android.application and the java plugin in the same module. Why are you doing that? There's nothing in the question you reference that tell you to apply the java plugin.

Remove the line with apply plugin: 'java', and you're good to go


For those who are using corporate/company custom gradle repo, remove or fix the init.gradle file from your gradle home. Location on Windows is C:\Users\User\.gradle\init.gradle. That's where all the nasty things happen.


For those that are using kotlin and are making an Android library: make sure to use apply plugin: 'kotlin-android' instead of apply plugin: 'kotlin'.