【问题标题】:gradle build error Execution failed for task. Process '/build-tools/23.0.2/aapt'' finished with non-zero exit value 1gradle build error 任务执行失败。进程“/build-tools/23.0.2/aapt”以非零退出值 1 结束
【发布时间】:2016-03-29 11:46:06
【问题描述】:

我在执行我的 Android 应用程序时遇到了这个错误(我清理它然后构建它,但错误仍然存​​在)

同步:好的

制作项目:错误

清理:错误

运行:错误

错误:任务 ':app:dexDebug' .com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/Jude/Library/Android 执行失败/sdk/build-tools/23.0.2/aapt' 以非零退出值 1 结束

我使用 'multiDexEnabled true' 启用了 multidex 支持,但错误不断出现。

我的 gradle 文件:

应用插件:'com.android.application' 安卓 { compileSdkVersion 23 buildToolsVersion '23.0.2'

defaultConfig {
    applicationId 'com.kakao.inhouseagit'
    minSdkVersion 16
    targetSdkVersion 23
    multiDexEnabled true

    buildConfigField "String", "DEPLOY_PHASE", "\"PreRelease\""
    buildConfigField "boolean", "DEBUG_TRACE", "true"
    buildConfigField "boolean", "inhouse", "true"
}

signingConfigs {
    debug {
        storeFile file('keystore/debug.keystore')
    }
    release {
        storeFile file('keystore/kakao.keystore')
        storePassword 'sksmswjstjfdlek'
        keyAlias 'kakao'
        keyPassword 'sksmswjstjfdlek'
    }
}

buildTypes {
    alpha {
        debuggable true
        signingConfig signingConfigs.debug
        buildConfigField "String", "DEPLOY_PHASE", "\"Alpha\""
    }
    beta {
        debuggable true
        signingConfig signingConfigs.debug
        buildConfigField "String", "DEPLOY_PHASE", "\"Beta\""
    }

    preRelease {
        debuggable true
        signingConfig signingConfigs.debug
        buildConfigField "String", "DEPLOY_PHASE", "\"PreRelease\""
    }

    release {
        minifyEnabled true
        shrinkResources true
        debuggable false
        buildConfigField "boolean", "DEBUG_TRACE", "false"
        buildConfigField "String", "DEPLOY_PHASE", "\"Release\""
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt', 'proguard_clearlog.cfg'
        signingConfig signingConfigs.release
    }
}

lintOptions {
    checkReleaseBuilds true
    abortOnError false
    checkAllWarnings true
    xmlReport true
    htmlReport true
    disable "InvalidPackage", "MissingTranslation"
}

packagingOptions {
    exclude 'META-INF/DEPEDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
}

productFlavors {
    inhouse {
        applicationId 'com.kakao.inhouseagit'
        testApplicationId 'com.kakao.inhouseagit-test'
        versionCode 82
        versionName '2.7.1.1'
        buildConfigField "boolean", "inhouse", "true"
    }

    io {
        applicationId 'io.agit'
        testApplicationId 'io.agit-test'
        versionCode 10
        versionName '1.0.2'
        buildConfigField "boolean", "inhouse", "false"
    }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.4'
}

repositories {
    maven { url 'http://maven.daumcorp.com/content/groups/daum-ma-group' }
    maven { url 'http://maven.daumcorp.com/content/groups/daum-public' }
}

dependencies {
    compile(group: 'com.kakao.sdk', name: 'kakaolink', version: '1.0.52') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile 'com.android.support:support-annotations:23.0.1'
    compile 'com.google.android.gms:play-services-gcm:8.1.0'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.guava:guava:18.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'commons-io:commons-io:2.4'
    compile 'org.apache.commons:commons-lang3:3.4'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.9'
    compile 'com.fasterxml.jackson.core:jackson-core:2.6.2'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.2'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.6.2'
    compile 'com.melnykov:floatingactionbutton:1.3.0'
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile('org.apache.httpcomponents:httpmime:4.2.2') {
        exclude group: 'org.apache.httpcomponents', module: 'httpcore'
        exclude group: 'commons-logging', module: 'commons-logging'
    }

    // for multi dex
    compile 'com.android.support:multidex:1.0.1'

    // for Emoticon SDK
    // emoticon sdk를 사용하기 위해 필요.
    compile(group: project.KAKAO_SDK_GROUP, name: 'kakaolink', version: project.KAKAO_SDK_VERSION)
    compile project(':emoticon')

    testCompile 'junit:junit:4.12'
    testCompile "org.mockito:mockito-core:1.10.19"
    compile "com.davemorrissey.labs:subsampling-scale-image-view:3.3.0"
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
    alphaCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
    betaCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
    preReleaseCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}

// TODO remove legacy package
useLibrary 'org.apache.http.legacy'

}

放之前还好

编译'com.android.support:design:23.1.1'

我用 Navigationview 更改了布局,所以我输入了 'com.android.support"desing:23.1.1' 然后错误不断出现。 现在,当我按下“运行”时,“Gradle Buid Running”大约需要 10 到 15 分钟,最终出现同样的错误。

我的项目 gradle 使用类路径 'com.android.tools.build:gradle:1.3.1' 如果有人可以请给我一些关于我哪里出错的指示,我将不胜感激。这可要了我的命。

谢谢。

【问题讨论】:

    标签: android android-gradle-plugin


    【解决方案1】:

    我在同样的问题上苦苦挣扎,但版本不同。我的 android studio 要求我将 build.gradle(模块:app)中的 buildToolsVersion 更改为至少 21.0.0 的版本。所以我从 20.0.0 切换到 21.0.0,然后我开始收到上面提到的关于 aapt 的错误消息。

    解决方案:我将 buildToolsVersion 更改为“23.0.3”,清理项目,重建项目,然后我能够在设备上构建我的应用程序而没有任何问题。

    我希望这会有所帮助。

    【讨论】:

      【解决方案2】:

      你在你的项目中编译了这么多 jars。等待的可怕经历 10~15分钟。

      内存不足错误可能会输出此日志:'以非零退出值 1'结束。

      我通过添加这个解决了类似的问题:

      dexOptions {
          javaMaxHeapSize "2g"
          preDexLibraries = true
      }
      

      试一试。希望对你有帮助。

      【讨论】:

      【解决方案3】:

      您可以使用如此多的库,这就是为什么您的项目需要花费大量时间来同步您的 gradle 文件,请检查是否有相同的重复库或访问此 [failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2

      这对我有帮助。 另一件事是compile 'com.android.support:design:23.1.1' 在我的项目中工作我正在使用最新的 sdk 和 API 级别 23 我希望这会对你有所帮助

      【讨论】:

      【解决方案4】:

      您可以进入 AdroidStudio 的菜单 Build->Clean Project。 然后重启 Studio。

      它曾经帮助过我)

      【讨论】:

        【解决方案5】:

        看来您使用的是过时的 gradle 版本。我遇到了 RUN 的这个问题,并通过这样做解决了这个问题:

        首先将“gradle”更新到最新版本:

        'com.android.tools.build:gradle:2.1.0-alpha4'
        

        并将 gradle 包装器更新到最新版本(在“gradle-wrapper.properties”文件中):

        distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip
        

        尝试从以下位置清除现金:文件 > 使缓存无效/重新启动。

        【讨论】:

          猜你喜欢
          • 2015-11-03
          • 2018-10-17
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-02-23
          • 2017-05-31
          • 1970-01-01
          相关资源
          最近更新 更多