Refresh list of drawables in Eclipse? - android

When I add drawable resources to my project they do not show up in the list of drawables in the Reference Chooser. I checked the R file and there are references for the files.
I have tried refreshing the project, cleaning the project, and fixing project properties and nothing seems to help. Sometimes a couple will randomly show up in there, but not all of them.
The only consistent way I can get them to show up is to restart Eclipse.
Any ideas?
Thanks
Edit: Further findings:
After some trials, I found an other inconvenient work around to he issue. Turns out when importing multiple files into the project at once, Eclipse will only add the last one imported into the reference chooser. So when I imported my images one at a time, they all show up properly!
Like I said, inconvenient considering the amount of images I have left to import, but maybe with this new information it may help nail down where the issue may be and a possible fix.

I too faced the same problem. I added an image to the res/drawable-hdpi folder, cleaned the project and was able to see the name of the image in the left pane in Eclipse. But when I tried to use this image using Reference Chooser and looked under Drawable, I didn't find it.
I simply exited from Eclipse, and started it again. It was there! Like many things in computers, problems can be resolved simply by restarting!

The only way I found to fix this is to include the generated R class itself.

I found out some new info again.
Since I am doing a port from Blackberry, almost all of my images' filenames have uppercase letters in them, so I end up importing them all and then having to rename all the images after they are imported into the project.
I tried renaming all of my images before importing them all into the project. To my delight, all of the images showed up right away in the reference chooser! So it seems there is a problem when you import files and they cause errors with your project and allowing all of them to show up in the reference chooser.
So if you have to rename files, do it before import!
I'm just not entirely sure that this is the only cause for this issue but it has solved the problem for me.

Related

Every file of Project Unfortunately Blank while deleting .metadata folder

I am stuck with biggest problem now. My .metadata folder is deleted unforunately. after that i have tried to import again but all Project is going to blank. No one file has code.
What can i do? please help.
If you've deleted your (I assume Eclipse?) workspace folder and you have no way to recover it (have you tried the recycle bin/trash, deeper data recovery methods, etc.?), then your work may just be lost.
This seems like a good time to suggest integration of version control into your regular workflow. Git in particular is a pretty popular system these days.

new Intent loading wrong xml files

I noticed today in one of my apps that when I loaded a new Intent for a certain few classes(these classes are determined from the click of an object on a Spinner), the layouts appear and they are like the original plain layouts I started with in my project, not the ones I updated and changed to make look better.
I checked all my code and everything, there are no xml files for what it's loading(they are old ones that I had used before). I don't understand why these old, non existing xml files are even loading. It should be loading the current ones I have in my project but it doesn't... Can someone help me with this problem? Thanks
If you're using eclipse, you can try doing Project > Clean, and then Refresh your project. This should make sure you are building with the latest resources.

Eclipse can see resources which do not exist

I am new to Android development.
I created an Android project, and imported some images as resources.
Unfortunately, one of them contained a capital letter, which is illegal. I have first renamed, then removed the offending image. Then I delete all images, but Eclipse still insists they are there after clicking refresh refreshing and running clean several times.
Could anyone tell me how to fix this?
If the file actually exists in your workspace . Just Right Click the file and select Validate . It should be alright

Is there any way to reset R.java for android application development on eclipse?

R.java is not responding. I made 4 layouts in res/layout and it took 3 layouts but not responding for 4th
If i edit the R.java will it stop regenerating the code ?
Project > Clean...
This will force Eclipse to delete and regenerate the R.java file.
Just came across same problem. Delete
Import android.R;
This should fix the problem and have all references re validated.
Check all of your resources for errors. Make sure there are no subfolders in your Drawable folders, make sure all resource names contain only lowercase letters, numbers, and underscores for their names, make sure any ninepatch images you're using are correct (use tools/draw9patch in your SDK folder). Clean your project after any changes to these.
If you can't find anything that looks out of place, start removing any resources you've added, removing the most recent first, and cleaning after each removal, and see if the problem goes away. If it goes away after pulling one out, then there's a problem with that resource.

Cannot find the culprit file in my android project even after expanding the main folder

The side bar in eclipse shows a red cross on the title of my project folder but there are no such signs in the directories below it in hierarchy. In which particular file does error exist? How can I know that?
Error log shows: Current file is not a match for the given config.
Sorry I just came across this now, but I've had the same error too, so I'm sure others have. There was a quite a bit easier solution than what you had to do, at least in my case. I had the exact same problem, where my main project said there was an error, so I couldn't debug or run, but there was no apparent error, other than the red X on my main folder.
In order to solve this, I simply closed the project by right-clicking on the main folder, and selected "Close Project". Then, I right-clicked on the closed project, and selected "Delete". Don't worry, this will not delete any files, it will only remove it from the workspace, and will make sure you really want to do that by asking you to confirm. Now, just click on File->Import and select "Existing Projects into Workspace". Choose your parent folder for your app that was erroring, and import it. The few times I've had the phantom error on my main app, this has fixed it each time.
Whether there is an underlying cause and this process simply refreshes something in the workspace, I'm not sure, but at this point this fix is fast enough for me to use it.
Hope this helps next time!
Project -> Clean
Closing project and opening it again fixed it for me.
formed a new workspace and formed a new project. Added each file individually. Now it shows no error.. but still can't figure out what was wrong with thr previous code..? :=(
I faced the same issue..
there was a problem in manifest xml..
the path was not set properly. there may be space in the path..
I just copied the activity tag from other project and pasted in my project and just edited the path in android:name. it worked fine..

Categories

Resources