1

I have this gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.pavel.myapplication"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

and this gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

It is new Project. And I get error after creating this project. New project created with this error(!!!)

Error:(25, 0) Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed.

I found this solution and commented this code

task clean(type: Delete) {
        delete rootProject.buildDir
    }

First error disappeared But now I get next error.

Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins.

I found solutions to remove 'java' plugin but I do not have this plugin

Sanjeet
  • 2,385
  • 1
  • 13
  • 22
ip696
  • 6,574
  • 12
  • 65
  • 128

1 Answers1

1

I found the problem. I have gradle.init file with 'java' plugin. Now I not use this config and delete this file. All works fine after that change!

Swati Bhartiya
  • 101
  • 1
  • 8
ip696
  • 6,574
  • 12
  • 65
  • 128