Android Studio无法编译

时间:2015-12-07 20:30:54

标签: android android-studio android-gradle

您好我的Android Studio存在问题:

Error:Gradle: Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Hady\AppData\Local\Android\Sdk\build-tools\19.1.0\aapt.exe'' finished with non-zero exit value 1

我尽力但我无法解决这个问题。

我的gradle文件是这样的:

apply plugin:'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
}

Import Clauses

我的AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="hadi.calculator">
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />
    <application

        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

4 个答案:

答案 0 :(得分:1)

您可能在activity_main.xmllayout_heig8t

中输入错字

纠正资源中的拼写错误应清除它。

答案 1 :(得分:1)

像Dalija一样,这是compileSdkVersion依赖项冲突的结果,所以请将您的buildToolsVersionheigh8t更新为最新的。{1}}和{{1}}。 您也可以(但强烈建议不要这样做)降级支持库版本

请随意查看此问题:Gradle finished with non zero exit value

编辑:检查单词的拼写以避免{{1}}

等错误

答案 2 :(得分:0)

您正在使用appcompat-v7:23.1.1,您应该将构建工具和SDK版本升级到最新版本。

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
}

您还可以从Android清单中删除SDK,因为Gradle设置会覆盖它们而不需要它们。

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />

此外,请注意像heig8t这样的拼写错误,并花时间阅读并理解哪些错误消息试图告诉您。大多数时候,答案就在那里。

如果显示找不到属性layout height的资源标识符,那么这意味着您最有可能拼出layout height错误。在这种情况下,它应该是android:layout_height

答案 3 :(得分:0)

请打开文件 - &gt;无效缓存/重新启动Android Studio它工作正常