Savita
Savita

Reputation: 747

Error:(4) No resource identifier found for attribute 'id' in package

I am getting this error for the menu item I have added for the toolbar.

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res-auto"
    xmlns:xmls="http://schemas.android.com/apk/res/android">
    <item
        android:icon="@drawable/ic_camera_iris_white_36dp"
        android:id="@+id/video_camera"
        android:showAsAction="always"
        android:title="@string/menu_camera_label"></item>
</menu>

Any idea on how to resolve this issue ? Here are the build errors

> Error:(4) No resource identifier found for attribute 'id' in package
> 'com.google.rabbit'
> 
> Error:Execution failed for task ':app:processDebugResources'.
> > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command
> 'C:\Users\sagar_000\AppData\Local\Android\sdk\build-tools\23.0.1\aapt.exe''
> finished with non-zero exit value 1

Upvotes: 0

Views: 581

Answers (4)

Pavel Cp
Pavel Cp

Reputation: 1

Resolved such issue with the following code:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/tools"
    xmlns:android1="http://schemas.android.com/apk/res/android">

Upvotes: 0

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

  1. Rectify your Root section with proper Tag

Finally

xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"

Then Clean-Rebuild-Sync .

 <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools">
    <item
        android:icon="@drawable/ic_camera_iris_white_36dp"
        android:id="@+id/video_camera"
        app:showAsAction="always"
        android:title="@string/menu_camera_label"></item>
</menu>

Upvotes: 2

Blackbelt
Blackbelt

Reputation: 157457

Error:(4) No resource identifier found for attribute 'id' in package 'com.google.rabbit'

Accordingly to the compile time error, you have the wrong namespace in your xml

<menu xmlns:android="http://schemas.android.com/apk/res-auto"
    xmlns:xmls="http://schemas.android.com/apk/res/android">

should be

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

Upvotes: 1

Amit Ranjan
Amit Ranjan

Reputation: 567

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.sixmod.MainActivity">
<item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    android:title="@string/action_settings"
    app:showAsAction="never" />
<item
    android:id="@+id/title"
    android:orderInCategory="100"
    android:title="@string/titlename"
    app:showAsAction="always" />
<item
    android:id="@+id/video_camera"
    android:icon="@drawable/ic_camera_iris_white_36dp"

    android:showAsAction="always"
    android:title="@string/menu_camera_label"/>

</menu>

Upvotes: 1

Related Questions