在新项目中以非零退出值1结束

时间:2015-08-22 16:34:28

标签: android gradle

我只是在64位系统上设置我所有的android设置,其中安装了API级别21和19也在每次设置每件事情后我尝试创建一个新项目,无论它的API 21还是19都失败了非零退出值

Error:Gradle: Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Android\android-sdk\build-tools\23.0.0\aapt.exe'' finished with non-zero exit value 1



C:\Users\rahul\IdeaProjects\MyApplication\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v21\values-v21.xml
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'.
Error:(1, -1) Gradle: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'.

2 个答案:

答案 0 :(得分:3)

您正在使用appcompat v21。

您必须使用api21编译项目。
build.gradle更改:

android {
    compileSdkVersion 21
    //...
}

如果您要切换到appcompat 23,则必须使用API​​23。

android {
    compileSdkVersion 23
    //...
}

答案 1 :(得分:0)

我分阶段出现这种错误......

必须记住

compileSdkVersion 必须与 支持库的主要版本匹配。

  
    

由于您使用的是支持库的第23版,因此需要针对Android SDK的第23版进行编译。

  

OR

  
    

或者,您可以通过切换到最新的支持库v22继续针对Android SDK的第22版进行编译。

  

如果,您需要将 compileSdkVersion 设置为 23

由于API 23 Android删除了已弃用的Apache Http软件包,因此如果您将它们用于服务器请求,则需要添加useLibrary' org.apache.http.legacy'如Apache HTTP Client Removal中所述的build.gradle:

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.0"
        ...

        //only if you use Apache packages
        useLibrary 'org.apache.http.legacy'
    }
    dependencies {
         //only if you use Appcompat dependencies
        compile 'com.android.support:appcompat-v7:23.1.1'
     }