Programmer
Programmer

Reputation: 54

Android Studio cannot compile

Hello I have a problem in my 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

I try all but I can't solve this problem ..

My gradle file is like this :

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'
}

enter image description here

My 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>

Upvotes: 0

Views: 9139

Answers (4)

Out Of Bounds
Out Of Bounds

Reputation: 31

Please Open File-> Invalidate Cache/Restart the Android Studio It works fine

Upvotes: 0

Dalija Prasnikar
Dalija Prasnikar

Reputation: 28519

You are using appcompat-v7:23.1.1, you should upgrade your build tools and SDK versions to the latest.

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'
}

You can also remove SDK from Android manifest, because Gradle settings will override them and they are not needed.

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

Additionally, pay attention to typos like heig8t, and take time to read and understand what error message is trying to tell you. Most of the times the answer will be right there.

If it says No resource identifier found for attribute layout height.. then it means that you have most likely spelled out layout height wrong. In this case it should be android:layout_height

Upvotes: 0

piotrek1543
piotrek1543

Reputation: 19351

like Dalija said it's a result of a build.gradle dependencies conflict so please update your compileSdkVersion and buildToolsVersion to newest one. Also you could (but this is highly not recommended) downgrade your support library version

Feel free to take a look at this issue: Gradle finished with non zero exit value

EDIT: Check also spelling of words to avoid mistakes like heigh8t

Upvotes: 1

Rein
Rein

Reputation: 911

It looks like you may have a typo in activity_main.xml: layout_heig8t

Correcting the typo in your resource should clear it up.

Upvotes: 1

Related Questions