Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android xml layout file is not being added to R.java

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

<ImageView
    android:id="@+id/imageNew"
    android:layout_width="50dip"
    android:layout_height="50dip"
    android:src="@drawable/icon"
    android:scaleType="centerCrop"/>




</LinearLayout>

This is my new layout file and it is not being detected by eclipse, nor is it in the R file. I can't create any new layout files or perhaps I'm doing it all wrong. All my older layouts are seen fine.

EDIT:

Also, a layout I had created previously I have edited with a new ID, however that new id is not detected either.

like image 348
Adam Avatar asked Nov 03 '11 18:11

Adam


4 Answers

I had the same issue. I took Eclipse's advice and removed

import android.R;

And replaced all references to R with the fully qualified name [project-specific package].R since the R file was actually being generated under some package, and the default contained nothing of interest.

You can check the package name by looking in the gen folder.

like image 148
user2587659 Avatar answered Oct 12 '22 23:10

user2587659


Clean your project or restart the eclipse, i guess it's the problem with eclipse automatic building.

like image 31
Yashwanth Kumar Avatar answered Nov 19 '22 20:11

Yashwanth Kumar


Look to the imports, the R imported maybe is not correct.

like image 22
Jon Zangitu Avatar answered Nov 19 '22 21:11

Jon Zangitu


I have this import

import android.R;

I've deleted this and layout is working again

like image 17
alexis Avatar answered Nov 19 '22 20:11

alexis