Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No resource found that matches given name in main.xml

Tags:

android

This is really starting to drive me crazy.

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@id+/textview"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:text="@string/hello"/> 

Produces the following error message: "Error: no resource found that matches the given name (at 'id' with value '@id+/textview').

This is copy and pasted from the Android hello world example.

like image 488
AndroidBeginner Avatar asked May 22 '10 18:05

AndroidBeginner


2 Answers

@+id not @id+. Seems the tutorial is wrong!

like image 84
Chris Avatar answered Nov 14 '22 18:11

Chris


It's just a small typo; you need to put the '+' after the '@', not after 'id':

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/textview"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:text="@string/hello"/> 
like image 8
Dan Lew Avatar answered Nov 14 '22 18:11

Dan Lew