• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps R file not generating

motowater

Lurker
I generated a new android project in eclipse. I then copied all the files from chapter 3 in my book over to the project. After doing so the R.anything is not available and the resource file is missing. I try to clean the project and generate it but it isn't working. Does anyone know what I can do to fix this error?
uRlR0.jpg
 
Are you sure that you are importing YOUR R.java file in your code? Sometimes Eclipse likes to think that you intended to import the android.R.java file.
 
Are you sure that you are importing YOUR R.java file in your code? Sometimes Eclipse likes to think that you intended to import the android.R.java file.

yup jonbonazza, i think you got the right idea. i think he might have
Code:
import android.R.java;
in there. happens to me all the time. stupid Control + O
 
I added android.R to my imports and I'm getting different errors. For example, the one in the screenshot has alert_label underlined.

I think the problem lies with my layout files and value files not being generated in the R file. In fact, the R file doesn't exist at all for me. Sorry I don't know whats wrong, its my first real android project.
 
You are not supposed to import android.R, you are supposed to import

your_apps_base_package.R

For example. if the bottom level package for my app was com.example, then I would need to do:

import com.example.R;


If that doesn't work, it's possible that you simply have errors in your XML files.

Other than those two things, there is no reason why it should point to the R file as errors.
 
Back
Top Bottom