No generated file in my project


I am doing the Notepad tutorial, exercise 2. I started by creating a new Android project and chose Create from source to import the downloaded source files for the excercise.

But now I get many errors in Eclipse, and the problem is that there is no generated class. How can I solve this? The folder gen/ is empty.

I have errors on and in res/layout/note_edit.xml and both seems to be related to the fact that the generated is missing.

Here is my import statements in

import android.R;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter; 

They are created by the Eclipse command Ctrl+Shift+O.

11/30/2010 12:57:15 PM

Accepted Answer

Go to Project and hit Clean. This should, among others, regenerate your file.

Also get rid of any import android.R.* statements and then do the clean up I mentioned.

Apparently Jonas problem was related to incorrect target build settings. His target build was set to Android 2.1 (SDK v7) where his layout XML used Android 2.2 (SDK v8) elements (layout parameter match_parent), due to this there was no way for Eclipse to correctly generate the file which caused all the problems.

5/3/2012 9:18:42 PM

After one whole day trying to find why R file was not generated, I found that after install Android SDK Tools r22 a new option in Tools was available: Android SDK Build Tools.

After installing it R file was generated again.

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow