Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

incompatible with attribute android:id (attr) reference troubleshoot

Tags:

android

I'm new with android studio software development, when I start building new software, this error happens.

error: '0+id/nav_home' is incompatible with attribute android:id (attr) reference. Message{kind=ERROR, text=error: '0+id/nav_home' is incompatible with attribute android:id (attr) reference., sources=[C:\Users\Ray\AndroidStudioProjects\MyCatholic\app\src\main\res\menu\navigation_menu.xml:14], original message=, tool name=Optional.of(AAPT)}

and this is my code

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

<item
android:id="0+id/nav_post"
android:title="Add New Post"
    android:icon="@drawable/add_post"/>

<item
    android:id="0+id/nav_profile"
    android:title="My Profile"
    android:icon="@drawable/profile_icon"/>

<item
    android:id="0+id/nav_home"
    android:title="Home"
    android:icon="@drawable/home"/>

<item
android:id="0+id/nav_friends"
android:title="Friends"
    android:icon="@drawable/friends"/>

<item
    android:id="0+id/nav_find_friends"
    android:title="Find Friends"
    android:icon="@drawable/find_people"/>


<item
    android:id="0+id/nav_message"
    android:title="Message"
    android:icon="@drawable/messages"/>

<item
    android:id="0+id/nav_setting"
    android:title="Settings"
    android:icon="@drawable/settings"/>

<item
    android:id="0+id/nav_logout"
    android:title="Log Out"
    android:icon="@drawable/logout"/>


</menu>

am I missing something ?

like image 708
Raymond Kristanto Avatar asked Sep 30 '18 12:09

Raymond Kristanto


1 Answers

android:id="0+id/your_id"

isn't valid syntax. It's:

android:id="@+id/your_id"

Replace all 0+id with @+id.

like image 189
TheWanderer Avatar answered Sep 20 '22 18:09

TheWanderer