【问题标题】:Error in compile SDK version?编译SDK版本出错?
【发布时间】:2016-08-18 10:20:15
【问题描述】:

谁能告诉我如何解决这个错误:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.2'
    defaultConfig {
        applicationId "com.example.abhishek.detector"
        minSdkVersion 10
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
    compile 'com.google.android.gms:play-services-location:8.1.0'
}

错误: 错误:任务 ':app:processDebugResources' 执行失败。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\hp-pc\AppData\Local\Android\sdk\build-tools\ 21.1.2\aapt.exe'' 以非零退出值 1 结束

【问题讨论】:

  • 您是否尝试过清理和重建?
  • 是的很多............
  • 尝试在defaultConfig 中添加multiDexEnabled true
  • 尝试@jaydroider 建议
  • 您的支持库版本和编译 SDK 版本必须匹配。尝试使用 API 级别 23 并更新您的编译 SDK 版本和目标 SDK 版本。否则使用 21.*.* 版本的支持库。希望它会有所帮助:) 不要忘记投票!

标签: android android-studio android-gradle-plugin


【解决方案1】:

从 values/string.xml 更改 sdk 版本

【讨论】:

    【解决方案2】:

    安装最新版本的构建工具。调整您的 build.gradle 以使用

    `buildToolsVersion "23.0.2"`
    

    或检查并从列表中删除重复的依赖项。

    享受:)

    【讨论】:

    • 我已经这样做了,它消除了错误,但是当我打开活动主或内容主来设计应用程序时,它会出现另一个错误:: 渲染问题无法实例化以下类:-android.support。 design.widget.AppBarLayout(打开类,显示异常,清除缓存) - android.support.design.widget.CoordinatorLayout(打开类,显示异常,清除缓存)
    • 我知道这没什么大不了的,但只有当你看到我的设计时,我也看不到设计
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-22
    • 2017-07-27
    • 2016-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多