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

So I’ve made a wearable application where I can control a robot-car with the buttons on screen with the MessageListenerService. After trying to build the project, I had some problems where it asked me to install “Android Support Repository” from the SDK, which I already had. I found another similar problem on SO (link) which had a sort-of solution, but now it says

“Error: The java Plugin has been applied, but it is not compatible with the Android Plugins”

  • Enums and android annotation intDef
  • Recycling Bitmap does not free memory
  • How to set focus on a TextView when an Activity starts?
  • JDK 7 with Android SDK R13 in windows 7
  • SyncAdapter not being called depending on order of Account setup calls
  • Is there a need to use super.onActivityResult() in onActivityResult()?
  • This is my build.gradle in my wearable module

    apply plugin: ''
    apply plugin: 'java'
    sourceCompatibility = JavaVersion.VERSION_1_6   //these two lines
    targetCompatibility = JavaVersion.VERSION_1_6   //are the only ones that matter
    android {
        compileSdkVersion 20
        buildToolsVersion "20.0.0"
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_6
            targetCompatibility JavaVersion.VERSION_1_6
    signingConfigs {
        release {
            keyAlias 'C:\\Users\\Riekelt\\coolie.jks'
            keyPassword 'cut-out'
            storeFile file('path/to/release.keystore')
            storePassword 'cut-out'
    defaultConfig {
        applicationId "robowheel.robond"
        minSdkVersion 20
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), ''
            signingConfig signingConfigs.release
    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ''
    compile ""
    compile ''
     //   compile ''

    Anyone know what is the matter? Thanks in advancoi

    Related posts:

    Import all imports in eclipse at once?
    ViewPager FragmentPagerAdapter Nullpointer
    Android: Difference between canvas.drawBitmap and BitmapDrawable.draw?
    How to kill currently running task in android
    Is it possible to change the style of an Android L TimePickerDialog?
    What is the unit of the ruler in Android studio layout editor?
  • How to clear stack back to root activity when user leaves application?
  • Android - New Data record is added to the wrong contact
  • Control onclicklistener in autolink enabled textview
  • Unregistering and re-registering for GCM messages causes two regId's to be valid. Is this as intended?
  • Hide Status bar on Android Ice Cream Sandwich
  • Android read text raw resource file
  • One Solution collect form web for “Android compile error; Java plugin has been applied, not compatible with android”

    The problem is that you cannot apply both the 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

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.