Android Studio继续使用sdk 23而我不想这样做

时间:2016-08-27 20:36:19

标签: android android-studio sdk

我对应用程序有一点问题。这是我几个月前建立的应用程序,它运行正常。

昨天,我做了一个改变,做了它,试图编译它..我有这个错误:

D:\android\MyApp\app\build\intermediates\res\merged\debug\values-v23\values-v23.xml
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\xxxx\AppData\Local\Android\Sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1

我的build.gradle包含以下内容:     android {         compileSdkVersion 21         buildToolsVersion '21 .1.2'

    defaultConfig {
        applicationId "xxxx"
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 21
        versionName "2.5"
    }
}

我不想升级到SDK 23(类似线程中最常见的答案),我想了解这里有什么问题,以及为什么我有这个错误,而我从来没有使用那个该死的sdk。

有任何线索吗?

1 个答案:

答案 0 :(得分:1)

我认为原因是Android Studio的自动更新。如果您从Sdk管理器下载了Build-tools rev.23,请尝试删除它,然后清理并重建项目。确保compileSdkVersionbuildToolsVersiontargetSdkVersioncom.android.support:appcompat匹配相同的版本。

更新:引用更新的build.gradle,问题在于使用动态依赖项(+符号),这将迫使gradle获取最新的库版本。根据{{​​3}}:

  

(...)使用动态依赖项(例如,palette-v7:23.0。+)   可能会导致意外的版本更新和回归不兼容。   我们建议您明确指定库版本(for   例如,palette-v7:24.2.0)