Alicia Sykes
Alicia Sykes

Reputation: 7107

Gradle fail: unsupported node 'item' in ids.xml

I'm having some trouble with getting my Android application to run since Gradle keeps failing. I have recently updated Android Studio to 0.8.0 and am trying to run a project that a friend (using the same version of Android Studio) modified.

The message from the Gradle Build just says:

    Error:Execution failed for task ':app:mergeDebugResources'.
   > Unsupported node 'item' in file   D:\Dropbox\Programing\GIT\AntiTheftCharge\app\src\main\res\values\ids.xml

Below is my ids.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item name="switchOnOff" type="id">switchOnOff</item>
    <item name="switchMovement" type="id">switchMovement</item>

    <item name="switchPower" type="id">switchPower</item>

    <item name="optTimeNone">optTimeNone</item>
    <item name="optTime2">optTime2</item>
    <item name="optTime5">optTime5</item>
    <item name="optTime10">optTime10</item>
    <item name="btnChoseTime">btnChooseTime</item>
    <item name="linear" type="id">linear</item>
    <item name="btnChooseTone" type="id">btnChooseTone</item>
    <item name="cmdStop" type="id">cmdStop</item>
    <item name="btnStop" type="id">btnStop</item>
    <item name="btnAbout" type="id">btnAbout</item>

   </resources>

Here is the contents of the build.gradle file from inside the app folder

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.1.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.android.support:support-v4:19.0.0'
}

Thanks for taking the time to read this, and any suggestions would be much appreciated :)

Upvotes: 4

Views: 4029

Answers (1)

Barend
Barend

Reputation: 17419

The problem is that you forgot to add type="id" to five of the items:

  • opTimeNone
  • optTime2
  • optTime5
  • optTime10
  • btnChoseTime

I would also advise you to remove the text content from all the id items, as it is not needed:

<item name="btnChoseTime" type="id"/>

The ID's become int values in your R.id class. The body content is ignored and discarded.

Upvotes: 3

Related Questions