android - aapt 以非零退出值 1 结束

标签 android gradle leakcanary

最近我正在尝试使用 LeakCanary 来修复我的 Android 应用程序的 OOM(内存不足)问题。我添加了

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'

到我的 build.gradle,按照 LeakCanary 网站上的说明操作。在 gradle build 之后,我得到了

"/android-sdk/android-sdk_r22.6.2-linux/build-tools/21.1.1/aapt'' finished with non-zero exit value 1 

这是我的 build.gradle 的一部分:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.1'
    }
}

apply plugin: 'android'
apply plugin: 'maven'

android {
    compileSdkVersion 19
    buildToolsVersion '22.0.1'

    defaultConfig {
        multiDexEnabled true
    }

    lintOptions {
        abortOnError false
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            assets.srcDirs = ['assets']
            res.srcDirs = ['res']
        }

        instrumentTest.setRoot('tests')
    }

    dexOptions {
        jumboMode = true
        preDexLibraries = false
        javaMaxHeapSize = '2g'
    }

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

repositories {
    flatDir {
        dirs 'libs'
    }
    maven {
        url "http://XXXXX/nexus/content/repositories/releases"
    }
}

dependencies {

    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile(name: 'ShortcutBadger-1.0.1', ext: 'aar')
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3'
}

最佳答案

当我将 CompileSDKVersion 更新为 22 并将 buildToolsVersion 更新为 22.0.1 时,它起作用了。 希望这可以帮助遇到此问题的任何人。

关于android - aapt 以非零退出值 1 结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30456606/

相关文章:

Android 根据 if 语句更改布局

android - 使用自定义 View 的 Dialogfragment 中的 ViewBinding

Android Market 应用内购买 : How to get the currency a user will pay in?

java - 安卓/Java : TextInputEditText leaks when it's Fragment gets destroyed

android - 具有rxBinding的setOnSeekBarChangeListener

gradle - 如何在 MarkLogic 中清除模块数据库

android - 如何使用 Android Studio 3.3 修复即时应用程序

gradle - Thymeleaf在gradle构建中失败

Android Leak Canary 和 StreetViewPanoramaFragment

android - 使用 Leak Canary 防止误报