I am working on one android application. Don't know why but i am not able to regenerate R.java file.
i also searched a lot about it. and also tried all the solutions i got from various place. but R.java is not generated.
if i import my project in another computer, then it is working fine. only have problem in my eclipse. :(
i also solved all the lint errors, warnings and also tried to clean and build project. i also checked my all .xml files as well as all images. all is perfect not any special symbols or uppercase. and and tried all the tricks which i got. but now able to generate R.java file.
please help me.. Thank in advance...
Edit :
right now i am getting one error like
Description Resource Path Location Type Error executing aapt: Cannot
run program "..\Android_SDK\build-tools\18.0.1\aapt.exe":
CreateProcess error=5, Access is denied: CreateProcess error=5, Access
is denied TestProject line 1 Android ADT Problem
Occassionally I am also fighting with this issue. Sometimes it's tough, but it's usually that something is wrong with your /res/ files. Usually XMLs.
First try to Clean your build, but you did that already.
Look for malformed XMLs, they do not have to be marked in red at first, but try to open them all if you don't see them popup in red. Check that you don't reference ids to another views in styles.xml, check for invalid characters in keys, check for invalid/unescaped characters in content of xml entities.
Also check properties of your project and make sure that all Java Build Path components are checked (Order and Export). Mainly Android one. Sometimes it happens to me, that it's unchecked making my project unbuildable.
If it works on another computer, it seems the code is fine. The problem seems to be either your toolchain or your Eclipse workspace.
Try the following:
If you use Android SDK Tools 17 or higher, make sure you install the corresponding Android SDK Build-tools in Android SDK Manager.
If the above doesn't help, create a new workspace and import your existing code into it.
This is common problem, which can be caused by many different situations.
What always worked for me:
If your R.java is not generated, your project is flooded with errors saying that class R is not recognized (obviously). Usually, somewhere between all those R.java errors, there was one other error (with different that all others) which is often overlooked because of hundredths R.java related errors. If i fixed this other error, R.java is generated after clean/build...
Edit: the "other error" i am talking about that is preventing your R.java to regenerate, is often found somewhere inside resource XML files...
The problem is in your installation path of Eclipse. Just check that your path doesn't have any spaces where you have installed Eclipse. And name should be proper for the Eclipse directory.
I also had the same problem because my Eclipse installation path got spaces in it, and my Eclipse directory name got changed to some symbolic name. When i renamed it to Eclipse and make the installation which contains no space, it got worked.
For example if Eclipse directory path is like
D:/New Folder/Android/Eclipse
Then it may got problem because of space between "New Folder".
Check your path and directory name and if it worked then check my answer please.
I was struggling with this issue for past one hour. I just solve it by
Remove the ".metadata" file from the workplace directory.
Then start the Eclipse.
Import the project from the workplace by File -> Import -> Existing project into workplace under General tab.
The R.java file will be generated. You need to import all other project that were in your workplace the same way.
Hope this will help someone
Related
I am running windows 7 and eclipse and keep getting this error. My XML seems to be fine and have downloaded all the Sdk build tools. What could be the problem?
Try to clean and re build the project.
The most all the time, the problems with R.java is caused by an error in your xml files, if you are sure that your xml are ok, and if you are working with Eclipse.
Follow the next instructions,
Go to Project menu -> Select Clean and verify that "Build automatically" is checked, and is ready.
If the problem don't disappear check if all your xml are correct.
Go to Project > Clean. If it doesn't work, check all your drawable files:Does any has a capital letter? space? underscore?
or dashes?
All the files name should all be in small, no space & no numbers.
In Eclipse view the problems view (window->show view->problems), it is almost always the fact that a file in your res/ folder has not actually been accepted by adt (an xml error or a file naming error usually, keep it lowercase), the red X indicates which one too..it will help you find the bad line or file. Once that is fixed R exists because it can now compile, and the import will work because that class now exists, good luck.
other answers relating to this did not help me out. Hence, I am posting a new question. I am trying to test a sample app of android that comes with their SDK. I get the error "R cannot be resolved to a variable". Looks like my R.java is not being generated. I don't know if I checked in the right place. I checked in the 'gen' folder of where I had downloaded my SDK and could not find the R.java file in the app which I am trying to test.
Could you please provide me with some ideas?
Thank you so much.
It happens when resources are not compiled. If you don't use automatic builds then just build your project. Otherwise it may happen because of some errors in resources.
I had the same problem(there was nothing under gen folder) and tried other solutions such as "cleaning project, checking if not android.R package is imported instead of mypackage.R, moving gen folder over src in java build path => order export tab and checking permissions of SDK executables" but none of them solved it.
Finally when I was checking one of the layout xml files in the res=>layout whether it has a problem or not Eclipse warned me with "The project target (Android 2.3.3) was not properly loaded" text. So I wanted to double check Android SDK Manager from Eclipse and found out that related SDK had an update. I did not see it before because it has a confusing structure with new or installed check boxes in my opinion.
When the 2.3.3 SDK updated all the problems gone...
Just clean the project and build again.
This is the most common problem I've found while developing for android.
Also try this Link for a detailed description about this issue.
Try to remove the read only in the properties of the sample sdk folder. That fix my problem i guest. Then remove the project in the eclipse. Restart eclipse. Then import it again.
If I run my project this error will come build path problem how to solve this error.
error:
Description Resource Path Location
Type Project 'videothumb' is missing
required source folder: 'gen'
videothumb Build path Build Path
Problem
The project cannot be built until
build path errors are resolved
videothumb Unknown Java Problem
Can any one help me?
Try to clean project and if it still doesn't help close and then open project.
IF you are using eclipse then do as follows:
right click your project.
select build path-->configure build path.
update all the broken links in all 4 tabs.
Go to project-->clean [project will be found at top menu of eclipse.]
Clean your project.
Its done. For any further explanation comment on my answer.
Hope this helps.
Edit:
Here you go:
As you can see i'm at source tab of configure build path and i have only one folder here named ATalk/Src. likewise you can have number of folders.
Check for red cross mark on folder. if its there then your folder path is wrong means link is broken for that folder.
Same way you can check in Libraries tab. There you will find list of jars in your project. If any of them have red cross then its path is missing. So update all such red cross paths.
As you can see i dont have a red cross on my folder means it is at correct location.
Hope you get my point.
EDIT:
I just noticed that, according to your screenshot, the problem seems to be that the adb tool is not found. Now I might be wrong but I think that as of Android 2.3 (maybe even earlier) the adb tool is expected to be in [path-to-your-sdk]/platform-tools folder, not in the [path-to-your-sdk]/tools folder. The later path was used in earlier SDK's and your problem might be caused by such a simple thing that you have an outdated Android plugin in Eclipse.
OLD, IRRELEVANT ANSWER:
I've seen these kind of issues in Eclipse environments when I have some kind of error in my XML files. Malformed errors (that violate the rules of the XML structure) are often treated as "syntax errors" and are shown directly when you write them or when you try to build your application.
Other errors, however, like giving invalid references (giving a dimension where an integer is expected, for example) are not always highlighted with file name and failing line number (I'm not sure if this is bug in Eclipse's android plugin or even if it's a bug at all).
These kind of errors you'll have to hunt down manually and rebuild your project (as dcave555 sugested). This is really boring work if you have many XML files with many changes in
I think the path should look like this: /home/embdes/projects/android/android-sdk-linux_86
The problem is because of your Android build path settings. Try to check:
Window > Prefereces > Android > Build path
it should properly set to your Android SDK
After I added some .png files into my Project Workspace drawable folder I refreshed my drawable folders in Eclipse and the newly added files showed up. But when I tried to access those resources using R.drawable.xyzimage, xyzimage although in the folder could not be resolved.
So I did a Project Clean and guess what after this clean R.java is totally gone and all my classes accessing resources using R.java is showing all sorts of error and Eclipse won't let me run the code anymore.
I have backup of my source code but I want to explore if R.java can be regenerated and how?
Thanks for all the help.
Try Project->Clean in Eclipse. In my limited experience if R.java is not being automatically created then there is an error somewhere in your xml. Triple check everything.
You have to build the project to be able to use the newly added resources.
Cleaning a project removes all auto-generated files. Building the project it should automatically create them. When you Clean a project, there's an option to start a build immediately after clean up.
Here's a few things you can try (did the same procedure after manually deleting the "gen" directory.
After you have deleted the gen directory, go to Project > Clean ...
You should have errors indicating that R cannot be resolved to a variable. Right click on your project from the Package Explorer and select Build Project. Be sure Build Automatically option is turned off (uncheck in Project > Build Automatically).
Errors regarding R should have now disappeared. Now, perform a Project Clean once again. All errors should be gone.
Let me know if this works for you.
Here is what the problem was. I added those new png images to the project and android has rules as to what characters are allowed in the names of these images. Once I changed the uppercase letters in the image name, it was back on track again and Build Automatically generated the R.java file and all errors were gone. Eclipse console is the place where I found all the errors related to my resources.
Thanks Guys....I tried your solutions but my error was something specific which was due to my image naming convention so this is the way I fixed it.
I would agree this is usually a XML problem but moreover that it is something within your res folder that is the problem and may be highlighted with a red cross after the clean attempt.
I have just had this problem and it was because I had created my own folder called 'data' within res folder. After the clean it had a little red cross against it. I removed this folder and R built again.
Regards,
Mark
Several things you should check in your project:
Check the Problems tab in your Eclipse IDE. Are you sure that you did not introduced building problems while making changes with drawables? To check that you need to check xml source of affected layout and see if something is marked red.
In File explorer go to the directory where your Android project is. Check that you have file default.properties (.classpath, .project and AndroidManifest.xml should be there). If default.properties is missing it may be easily replaced by correct version.
Which is the Android version you are working with? If that is 1.5 or lower be sure that in the res directory you have directory named drawable, not drawable-hdpi, drawable-mdpi and drawable-ldpi. Last three are valid for version 1.6 and higher.
Right click on your project in Package explorer in Eclipse. You will get a number of options. Go to Android Tools-> Fix Project Properties so see if that helps.
I had an invalid jpg in my res/drawable folder. I removed the jpg and it worked.
I had this problem on my Mac too and I think it could be good to know for all Mac users how I managed to solve this error.
I had a .DSStore file automatically imported to my project inside the res directory and when I removed it and rebuilt the project all went well.
Everytime you clean the project and it rebuilds, it imports
import.android.R
so, delete this import and remove all errors from xml files. It will work.
This happens to me if I move my project to a new location. I have found that the answers above didn't fix my problem, but that creating a new project and importing the source did.
This may be simple but check to make sure you don't use
import android.R;
If you add an external resource file with capital letters for example
"Hello.png or WelcomeSound.mp3 etc etc" like if you add upper case letters and clean your project you'd surely loose your R.java file. So if you already lost it, either rename the file externally and then clean your project or else right click on the project Refractor->Rename and then rename your file with all letters in lower casing. Next, delete the 'gen' folder in the project explorer and now right click and "Build Project". If Build Project option is grayed out, go to Project-> Deselect "Build Automatically" option.
Regards,
Kshitij Thube
Check at the Console View If there in message Error, It will Help you to find out the source of the probleme.
I had i similar probleme and i find out that the probleme was from the pic name even if the name respect the Syntax so I change it to img1 and it worked fine.
Try editing one line of code in your project, then build the project once more.
Another thing: never try to run an application with the texteditor opened with a xml file. That will create a wierd run configuration that can only be fixed by project clean-up and sometimes can make the xml file to vanish (happened to me twice already).
All my R.* files stopped working after I did a Project->clean in Eclipse. The issue was that I backed up a XML file attached to one of my activities in the layout directory. This causes errors in every activity of my project.
After deleting the file I still had R errors in one of my Activities and it only was resolved after I tried importing different files and then deleting them. I actually made no change to the previous imports but for some reason deleting them all and re-pasting them fixed it.
I have got the same problem after lots of cleaning and building project again and again. I found that on console there is this error:
res/drawable-hdpi/Blue Blank.png: Invalid file name: must contain only [a-z0-9_.]
and this is not appearing as an error in xml. I changed the name and save the file, clean project and build. Now it's working. My suggestion check your res folder and name of files you use in it and name only [a-z0-9_.].
Delete related tag in xml, save xml, clean project, build project. Now again put that resource in xml and save!
Check your file in drawable folder ensure that all are resource file (image) remove unwanted file Like thumb.db. Remove those all files and check again
Make sure your png files have lowercase names. That is what kept throwing mine out, because I capitalized the first letter, or I used an unallowed non alpha numeric in the naming. Check that before destroying any of your code.
just check your image folder (usually created res > drawable files) and be sure dont use capital letters on .png files, every type must be in small letters then you can find again your R.java under the gen file folder
i removed 'import android.R;' then commented out the offending lines, then did a build, ok
then i removed the comment and it fixed it
I had the same problem when I cleaned my project. I got crazy to solve it, I searched and searched but solved it in my way.
First of all, delete all needless files in your /res folder. I had some notes in it, I took them to another project that I don't work on it and build the project manually. It worked! Try this I'm sure it will help.
Good developing!
Was there an XML file with the naming convention of "somthing.out.xml" generated? If so you should delete this file (an unwanted file of this name can cause major problems for your somthing.somthing.R file import).
In some versions of eclipse (I know eclipse javaEE does this for sure), running the project while viewing an XML file will create a file called filename.out.xml in your res->layout folder. You must delete this generated file if this has occurred otherwise you wont be able to get the java.R file to import.
Try Project -> check Build Automatically
If you are using 64-bit Ubuntu, try to install the 32-bit libraries (ia32-libs)
$ sudo apt-get install ia32-libs
it worked for me
This exact same thing happened to me. coincidentally I needed to update my adk that day, so i did so and after restarting eclipse it worked again. My recommendation would be to build the project and restart eclipse. It is not due to any error in your code.
I read and tried many of the above after simply doing a clean on one project. Eclipse would not build anything afterwards.
Fortunately I had last-nights backup of the workspace and my source is copied in from VS 2010.
No more cleaning!
Delete your project from workspace witout source deleting and then import it into workspace.
RightClick on your Project -> Delete /Don't select "Delete project content on disk (cannot be undone)"/ -> Ok
File -> Import -> General -> Existing Projects into Workspace -> Brouse -> /Look for your workspace(!) folder/ -> Ok -> /your cleaned project will be automatically checked/ -> Finish
I had the dreaded missing R problem yesterday with Eclipse Juno after a routine clean. StackExchange is full of suggestions and extensive googling revealed only the usual suspects (XML naming conventions problems, etc) none of which seemed to apply directly, although it is certainly possible I missed something.
The best summary comprehensive list of possible causes and fixes was here:
http://www.techrepublic.com/blog/software-engineer/a-comprehensive-troubleshooting-guide-for-androids-r-cannot-be-resolved-error/
One useful tip there was to try to create and run a simple "Hello World" in my workspace. If that does not run, the setup is corrupted. My Hello World was just as full of errors as my custom app.
The solution that worked for me (perhaps great overkill but nothing else worked) was to completely uninstall Android SDK and delete Eclipse (Juno), download Eclipse for Developers (Kepler) and reinstall Android ADT plugin and ADK and recreated my AVDs using the latest "compile with" version in options.
So far so good, although I am recreating the app from scratch. I will be more cautious about using clean from here on.
I have same problem occur just now I renamed invalid png file like *demo.1.png as demo.png * and its work.
Proven successful method, check the file (AndroidManifest.xml) and delete all comments in it, and make sure there are no errors in this file, I tried and did work with me.
I've found out that my R.java is never updated, so it doesn't contain information about my new resources, so I decided to delete it and thought that Eclipse would generate a new one. But that didn't happen, and I don't have R.java now. How can I regenerate one?
I'm using Windows 7.
From one of the comments: "Doing Project -> Clean is what caused the problem for me. Cleaning deletes R.java...and for whatever reason the plugin is not regenerating the file."
I found this happening to me with a broken layout and everything blows up. Relax, it's like that old mistake when you first learned programming C where you forget one semicolon and it generates a hundred errors. Many panic, press all the buttons, and makes things worse.
Solution
Make sure that anything the R. links to is not broken. Fix all errors in your XML files. If anything in the ADKs are broken, R will not regenerate.
If you somehow hit something and created import android.R in your activity, remove it.
Run Project -> Clean. This will delete and regenerate R and BuildConfig.
Make sure Project -> Build Automatically is ticked. If not, build it manually via Menu -> Project -> Build Project .
Wait a few seconds for the errors to disappear.
If it doesn't work, delete everything inside the /gen/ folder
If it still doesn't work, try right-clicking your project -> Android Tools -> Fix Project Properties.
Check your *.properties files (in the root folder of your app folder) and make sure that the links in there are not broken.
Right-click your project > properties > Android. Look at the Project Build Target and Library sections on the right side of the page. Your Build Target should match the target in your AndroidManifest.xml. So if it's set to target 17 in AndroidManifest, make sure that the Target Name is Android 4.2. If your Library has an X under the reference, remove and re-add the library until there's a green tick. This might happen if you've moved a few files and folders around.
What to do if R doesn't regenerate
This usually happens when you have a broken XML file.
Check errors inside your XML files, mainly within the /res/ folder
Common places are /layout/ and /values/, especially if you've changed one of them recently
Check AndroidManifest.xml. I find that often I change a string and forget to change the string name from AndroidManifest.xml.
Check that Android SDK Build-tools is installed. Window -> Android SDK Manager -> Tools -> Android SDK Build-tools
Make sure when you update the Android SDK Tools, you also update the Android SDK Platform-tools and Android ADK Build-tools. Build fails silently if they don't match.
If you can't find the issue, right click /gen/ -> Restore from local history... -> tick R.java -> click Restore. Even if it doesn't solve the problem, it will clear out the extra errors to make the problem easier to find.
This site suggests:
if you run a clean on the project it should regenerate all the generated Java files, namely R.
...and...
In Eclipse, under the Project menu, is an option build automatically.
That would help you build the R.java file everytime modifications are
made. The Clean... option is also there under Project.
This site suggests another solution.
I had the same issue. When I checked it out I found that the name of the XML resource under layout was not having the correct naming convention. It had some capital letters. So I renamed it to make all letters lowercase and the magic worked.
One reason the R.class can go missing suddenly is when there are errors in you XML files. For instance, when you add an XML file with uppercase letters in the name like myCoolLayout.xml which is not allowed. Or when you have references that don't point to existing files, etc.
In Eclipse, simply use Project --> clean to clean the project. The
R.java is going to be automaticly (re)-created.
If for some reason that dosn't work: Make sure your layout.xml files don't contains errors. Eclipse seems to be a bit buggy here: sometimes it doesn't mark the errors within the XML nor the package explorer. In such a case: Take a look at the "console" or "problems" view after using "clean". All errors should be displayed there. Fix them and redo a clean.
NOTE: It is NOT neccessary to fix the errors you get because of a missing R file! Just fix the XML files and other project errors and use clean!
Quick fix:
The package name in the manifest needs to be the same as the one in the /src folder, the /gen folder package will be automatically reproduced.
Detailed observation:
Observe the name of package in the /gen folder. In my case it was different than the one in the /src folder.
The package referenced in the manifest was that of the /gen folder.
I attempted to add a package with the name of the /src folder to the /gen folder too see what would've happened, but this did not solve the issue. I proceeded then to remove the package name that was not the same as the package name of the /src folder. This package with the name that did not correspond to the /src folder was recreated as soon as I removed it.
Since the package reference in the manifest corresponded to the one that was being senselessly recreated and that did not correspond with the package in the /src folder, this prompted to rename package = "oldPackage" with the package = "srcFolderPackage".
I had the same issue, and I finally found the problem: In the strings.xml, I did not keep the line <string name="app_name">program-name</string> which is present by default when creating a new Android project. I thought it was only used for the program HelloWord, which is the original program.
However, the AndroidManifest.xml refers to this value, hence:
=> A compile error;
=> the R.java isn't updated;
=> ID are not recognized...
Android has added in SDK build tool ADT 22 for the building mechanism. You just need to do the following steps.
Update Android SDK Tool
Update Android SDK Platform Tool
Update Android SDK Build Tool
Add the path of your build tool to the path variable. (path up to---- YOUR DIRECTORY-PATH\android-sdk\build-tools)
This will solve the issue.
If your R.java isn't getting generated, one of the solutions is to delete the layout file named "blabla.out.xml".
After deleting this file, try cleaning the project from menu Project -> Clean.
As a generalization of Glaux's answer, if you have any errors in the res directory, then R.java may not generate - even if you clean and rebuild. Resolve those errors first.
As an example: when you add an image file of say, "myimage-2.jpg", the system will consider this an error, since file names are limited to alphanumeric values. Do a refresh on your 'res' directory after adding any files and watch the output in your console window for any file name warnings.
If your OS is Ubuntu, I can provide some suggestion:
Install or upgrade ia32-lib:
sudo apt-get upgrade ia32-libs
Check if you have the right permission on the aapt folder:
cd ANDROID/adt-bundle-linux-x86_64-20130522/sdk/build-tools/android-4.2.2
chmod 777 aapt
Start Eclipse:
sudo eclipse
Run Project -> Clean in Eclipse
You 100% have an error in an XML-file, but the XML verification does not show you the error. This is the reason why you need to check your XML files first!
It is ALWAYS helpful to take a look at the Problems Tab in Eclipse. In my case, I was getting a "android unable to resolve target 'android-8'" error message that kept the R.java from being generated. So, I corrected the imported target to the one I was using in the default.properties file, then I performed a clean via Projects->Clean and voila! R.java is automatically generated! Hope it helps!
Cleaning project, closing Eclipse, re-opening it and launching my project finally made my R.java to reappear... Hope it helps
Make sure you are not importing
android.R;
R.java will never be generated if there are any errors in the res folder. For example, in the drawable subfolder there are two files which have the same name, one is icon.png and the other is icon.html.
You can see some error in the Eclipse console log window which is saying "Resource entry icon is already defined.". After deleting icon.html, you can clean or just delete the gen folder. You will find that R.java is created.
I've found that any file that has capital letters in the res folder will create this error. This happened to me with a PNG file I added and forgot about.
After reading through many posts and YouTube videos, I found that each of us have R.java missing for different reasons.
Here's how I fixed this in Eclipse:
Create R.java in gen folder manually and save.
After that go to Project and click "Clean"
The following message will display and your file will automatically be rewritten:
R.java was modified manually! Reverting to generated version!
For me, I had linked v7 appcompat twice. Anyhow, in Eclipse, right click the project name in Package Explorer or Navigator, go to Properties, Android, and uncheck any duplicates in the Library section. You may need to Build --> Clean afterwards.
There's obviously no one final answer to this, but here's another one I don't see here already:
I've had R.java disappear after (attempting) a Team Synchronize, and there were conflict resolution files in the project (i.e., thingy.xml.mine,thingy.xml.r35, etc.). Deleting them/resolving the conflicts regenerated R.
I had this problem. Accidentally I deleted this
xmlns:tools="http://schemas.android.com/tools"
which started causing build errors all over the project in my XML files as well as my Java files. As soon as I retyped what I deleted, it worked again :)
OK so it's clear that there can be a lot of causes for this problem. If you're on a 64 bit linux machine and you are just setting up the ADT for the first time, you may get this problem where R is not automatically generating. Check the console tab and you may see an error similar to:
'No such file or directory' while attempting to get adb version from '/home/patrick/code/android-sdks/platform-tools/adb'
If that's the case you need to install ia32-libs, using something like:
sudo apt-get install ia32-libs
See here for details: Android adb not found
I've came across this problem a few times. I found that if I didn't import the package R through my application's name, for example, if my application had the package name example.test then I found that I had to import example.test.R in order to access any of the resources.
If this wasn't imported then the resources that where getting returned were the default resources with none of my own included.
With that said if you find that you are only getting a list of default resources then just check to make sure that you're importing application_package_name.R and not android.R.
My problem was that appcompat was not in the same directory as my project.
I found this out when compiling my app with Ant.
Also make sure that you have the latest version of the ADT plugin, and open the Android SDK manager to update all SDK tools to the latest version. Check for updates in Eclipse itself as well. Non-matching versions caused the problem for me.
My problem was inside a menu file.
The compiler doesn't seem to warn you if strings which do not exist inside strings.xml are referenced in menu files. Check if your items in your menu XML files reference any strings which do not exist in your strings.xml. Usually in android:title.
For me, this error was caused when I tried to duplicate an existing res/menu instead of creating one with the wizard.
All of these answers could not work if you use Maven. The solution for me was to add
<genDirectory>${project.basedir}/gen</genDirectory>
to the configuration section of android-maven-plugin.
I found a solution why R.class is not made by Eclipse after making it again - 2 clean, build, etc.
The problem is here in strings.xml:
<string name="hello">Hello World, HelloAutoComplete!</string>
<string name="app_name">HelloAutoComplete</string>
These are by default created by Eclipse when you create projects.
Definitely you are changing the strings.xml for your own requirement. Sometimes you clear the string.xmls these two lines from your code:
It is making a problem in the AndroidManifest.xml file:
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloAutoComplete" android:label="#string/app_name">
So it can't communicate with strings.xml.
I changed my layout XML file name and found out later that of the XML file (widget provider in this case) still refers to the old layout XML which doesn't exist, and that prevented the auto generation/correction of R class.