aapt error on android - android

When I have an layout test.xml file open and click on Run Android creates an empty test.out.xml file and creates an "Unparsed appt error".
Even when I delete the newly created file the "Unparsed appt error" doesn't disappear.
What happens here?
How can I fix the error? Is there a way to prevent this from happen when I accidentally click on run while in a .xml file instead of being in a .java file?

If you run Project/Clean, the error will go away.
Regarding preventing this from happening, you have to change the build action for XML. I have not spent the time figuring out how to do that, but since this is such an annoying thing, I'd be glad if someone could post the steps.

Related

I still can't resolve symbol R

my android studio cannot resolve symbol R. everyone keeps saying all you have to do is check your XML files and sync bla bla. i have done all that like 10 times now but still. there is no error in my XML files. please someone should tell me something different
Use invalidate caches and restart option from the first menu (on a phone so can't remember the menu name) . That should work. After all is done, make sure to also clean build to ensure everything is fine.

Android Error or Bug Idk?

ok so here's the problem in eclipse I am making a metric to standard and back calculator but I keep getting errors and I had to delete one of my layouts and remake it but now when I remake it it brings up the old layout and I am so confused and now when I try to edit it and save it I get this as a popup message:
title:Update Conflict
message:The file '/TemperatureConverter/res/layout/measurement.xml' has been changed on the filesystem. Do you want to override changes made on the file system?
What do I do to fix this?
I got it I just had to do allot of deleting and cleaning... sorry for wasting your time guys

errors with XML layout and R.java is missing

hi I'm working in my android app. and suddenly today while I was working I got two errors
1- the "R can't be resolved as a variable" error.
2- and the "Couldn't resolve resource #string/app_name" erro, at the graphical view of .XML layouts.
I did lots of searching and lots of trial and error(clean, build, restart eclipse, restart laptop, and others but none could get me out of this trouble.
I also noticed that My R.Java is gone
I found while I do online searching that R.java could be gone"not auto generated" if there's error with XML or errors such as number 2 error.
last thing which I think might have caused the error is I added two elements in string.xml.. but anyway I have deleted them already.
so could any body help me how to jump this issue and continue with my development
At a guess I'd say that there is something wrong in your resource files which is stopping it from compiling them into the R file.
Take a good look at you string.xml file. The error is almost 100% there .
Have you forgotten to close some tag?
Check that your #string/app_name is well defined too ..
Remove this line: import android.R
note: R.java could be gone not auto generated unless you have no error in project.
now you count replace #string/app_name by "app name" and clean again. after find where have error
In my experience this message is almost always something to do with an error in one of your XML files: could be string.xml, any of your layouts, styles etc.
My advice would be to open up each one of them individually and check through them. An error in the layouts (res/layout/..) should be easy enough to spot (don't forget to check your res/menu/.. also). An error in one of the value XML files (res/values/..) can be tricker to spot. As some of the others have mentioned, a simple error in these files can cause this: one of my most common ones is to have typed "sting" instead of "string" or something similar.
I have often found that even after fixing some of these it is neccessary to close everything down and start Eclipse again.
Just import com.your.packagename.R
See my answer here Cannot find R.layout.activity_main

Newly created layout files not added to R.java

I have tried literally everything to figure out why no new layout files are being added to my R.java file in eclipse. Nothing is working.
I have:
Restarted Eclipse
Used Project>Clean
Deleted R.java (had to restore because it would not autoregenerate no matter what I did)
Ensured all methods are defined in SDK version
Rebuilt the project
Unchecked auto-build
Every combination of above options
Been tempted to throw my computer across the room
Does anyone have any suggestions?
Check you don't have any errors inside one of your xml files. That is, check not only for xml file name errors but also for errors in the xml code, for example an illegal attribute, a forgotten tag etc. Check this in all your xml files, not just layout files but also anim, xml drawables etc. These errors don't show up in the error log but will prevent the R.java from being generated.
When I experienced the same issue as you this was often the reason. The error highlight was only visible inside the file, not the error log.
Net, go through every xml file with a fine comb.
I faced this kind of problem many times. From my thoughts it is caused due to the problem of images in the drawable or case sensitive of layout file (everything should be small). Check your case sensitive of layout file.
I will give all possible solutions that i had done when something like this happened with me
Project-->clean
Check for library if there was any for that
RightClick-->Properties-->Android-->add
Restart Eclipse
Check in
the manifest for if you have many packages make sure u are using the
activity declared package.
I would check the imported R. The problem could be that you have
import android.R;
instead of
import com.myproject.R;
Project -> and check Build Automatically
Is there any error in your resource files? If there is any error in your resource files the R file will not be generated.
When first of u go on Project->Clean the your application then refreshing and auto genrated R.java file for your apps.
Not to be repetitive, but did you check the Android manifest file? The error there doesn't usually pop up.
Did you check for other locale letters (maybe whitespaces too?) in the filenames? Letters that look exactly like Latin.
I think I had similar problem with the names. You can try rewriting your files' names.
Project Explorer (Right click on your project) -> Build Project
This worked for me.

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