亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

錯誤:無法添加任務“清理”,因為具有該名稱的任務已存在

錯誤:無法添加任務“清理”,因為具有該名稱的任務已存在

暮色呼如 2022-07-27 21:50:22
我在從 Gradle 構建時遇到問題。這是我面臨的錯誤:錯誤:無法添加任務“清理”,因為具有該名稱的任務已存在。這是我的 Gradleapply plugin: 'com.android.application'android {compileSdkVersion 28buildToolsVersion "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 GradleCompatibleimplementation '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     } }如果有人知道,請給我解決方案。
查看完整描述

1 回答

?
四季花海

TA貢獻1811條經驗 獲得超5個贊

您在項目級別定義了此任務build.gradle(如您的評論中發布的那樣):


task clean(type: Delete) { 

    delete rootProject.buildDir 

}

Android Studio 的 Gradle 包裝器已經clean定義了一個任務,因此無需重新定義它。只需從項目級build.gradle文件中刪除該任務即可。


查看完整回答
反對 回復 2022-07-27
  • 1 回答
  • 0 關注
  • 283 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號