2017-11-04 1 views
1

は、私はそれが新しいプロジェクトでこのGradleのファイルエラー: 'java'プラグインが適用されましたが、Androidプラグインと互換性がありません。 AndroidStudio 3.0

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' 
} 

このGradleのファイル

// 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 
} 

を持っています。このプロジェクトを作成した後にエラーが発生します。このエラーで作成された新しいプロジェクト(!!!)

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

私はthis解決策を見つけたと、このコード

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

最初のエラーコメントが消えてしまった。しかし、今、私は次のエラーを取得します。

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

私は "Javaのプラグインを削除するために解決策を見つけましたが、私はこのプラグインに

答えて

0

を持っていない私は、問題を発見しました。私は 'java'プラグインでgradle.initファイルを持っています。今、私はこの設定を使用せず、このファイルを削除します。その変更後はすべて正常に動作します!

関連する問題