ERROR:その名前がすでに存在してタスクとしてタスク「クリーン」を追加することはできません

ムハンマドズバイル:

Gradleのから構築しながら、私は問題に直面しています。これは私が直面していますエラーです。

ERROR:その名がすでに存在するとタスクとしてタスク「クリーン」を追加することはできません。

ここに私のGradleであります

apply plugin: 'com.android.application'android {
compileSdkVersion 28
buildToolsVersion "25.0.1"
defaultConfig {
    applicationId "net.accedegh.retrofitlibrary"
    minSdkVersion 17
    targetSdkVersion 28
    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'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation "com.android.support:recyclerview-v7:28.0.0"
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.github.jd-alexander:LikeButton:0.2.0'
implementation'com.github.bumptech.glide:glide:3.7.0'compile 'com.github.varunest:sparkbutton:1.0.3'
implementation 'com.android.support:design:28.0.0'
androidTestCompile 'junit:junit:4.12'}

トップレベルbuild.gradleファイル

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
buildscript { 
    repositories { 
        jcenter() 
        google() 
    } 

   dependencies { 
        classpath 'com.android.tools.build:gradle:3.3.2' 
       // NOTE: Do not place your application dependencies here; they belong 
       // in the individual module build.gradle files 
   } 
} 

allprojects { 
    repositories { 
        maven { 
            url 'maven.google.com' 
            name 'Google' 
        } 
    } 

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

誰もが知っている場合、私に解決策を教えてください。

マイケル・ドッド:

あなたは、プロジェクトレベルで定義され、このタスクを持っているbuild.gradle(あなたのコメントで掲示されます):

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

アンドロイドStudioのGradleのラッパーがすでに持っているcleanので、それを再定義する必要はありません、定義されたタスクを。ちょうどあなたのプロジェクトレベルからそのタスクを削除しbuild.gradleたファイル。

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=196098&siteId=1