<TextView
android:layout_width=""
android:layout_height=""
It seems like Android Studio has removed the auto closing tag?
I have browsed and dont find any solution for this....
Here is what its look likes
First confirm that your project has finished background processes like indexing..
Then just typing < you will find suggestion...
After filling the recommended properties you need to type either
/
or
>
autocompletion will happen...
That's all.
Sometimes these issue occurs with the idea.
Just go to File -> Invalidate and Restart
->Press blue button: Invalidate and Restart.
I want another new activity in my project but i can not make it. I don't know what is the problem but the java activity shows red. Please help
You are probably having an issue somewhere in your XML-files which cause an error and so the R.layout-files can not be compiled. This is the reason why your activity_main2-Layout is in red. Unfortunately Android Studio does not highlight the file with the root error.
Invalidate cache and restart the android studio.
Place your cursor at the red labeled text. A dialog will prompt with more details about the error. Could you show us that error?
Also. It would be helpful if you paste the whole code of the Main2Activity, not a screenshot please.
The error I am getting is : "The color "colorRed" in values has no declaration in the base values folder; this can lead to crashes when the resource is queried in a configuration that does not match this qualifier less... "
I have tried clean project and rebuild and also tried invalidate cache & restart but still that error not going.
I have attached screenshot of colors.xml file
I solved the problem cleaning the project and build it again. If it doesn't work, invalidate caches and restart.
I'm using Android Studio 3.2
Invalidate Caches with File > Invalidate Caches / Restart... > Invalidate and Restart
Its a bug, and it happens for dimensions and possibly others. (Not just colours.) First time I saw it was the day I upgraded to AS 3.2.1.
But you may not need to clean, rebuild or invalidate caches. Try this:
(A) Cut and save (e.g. to NotePad) the flagged XML from the base folder and all qualified folders.
(B) Paste it back in, starting with the base folder
Update: 10Jan2019 [Dumb and dumber]
In fact, not even cutting and pasting is necessary. Suppose the following line is giving the problem...
<string name="edit">Edit</string>
Just change the tag to anything. e.g.
<xstring name="edit">Edit</string>
Then wait a second for removal to occur before changing it back
It's a weird bug. but here's a Workaround:
Open the file in android studio and select all the text.
now cut all the text and paste it in the same place.
(or simply, go to the problematic file and press- 'ctrl+A' --> 'ctrl+x' --> 'ctrl+v')
this does not change anything but apparently solves the errors.
This error occures still in AS3.4C10... so it is not solved yet.
For me, the only remedy is to select "Invalidate Cache/Restart" from File menu.
RG
Cleaning Project solved my problem
I might be a bit late to the party, but the latest update of Android Studio (v3.2 Canary 17) seems to have solved this bug.
I had a similar issue with colors and resources and updating Studio seems to have fixed it.
Hope this helps!
This is not an error. It is the IDE bug.
Run the project and error will be automatically resolved.
I quit and restarted Studio and the error went away.
It has occurred for me many times. This appears an Android Studio bug to me.
This may really not be an error though Android Studio shows it temporarily, most likely due to different code in generated files.
Most of the time this error goes if we run build or clean project and rebuild project. Android studio restart is not always required.
If that does not work invalidate cache and restart android studio.
This Error can appear for any of xml files. Not just colors. If you see too many errors, it's surely this one. However, sometimes the error occurs even for just one line. That can be difficult to identify. If you think the error is totally illogical, try a rebuild.
Very rarely I have seen this kind of absurd errors in Kotlin or Java files as well which go away on clean build.
Open Resources->Add new Resource -> choise "New Color value.." other defend on you
I using in android 3.3.1
I'm late to the party, but I fixed this problem by just altering the typing work. I added some more spaces to make it look cleaner and more readable and suddenly the red underline and error messages were gone. Must have been a bug of sorts.
(Studio 3.3.3)
I had same error. I just ran the project with same condition and the error went away.
Did you paste it in from a spreadsheet? If so, just check that everything that looks like a double quote is in fact a double quote. Spreadsheets are a great way to build lengthy resource files, concatenating cells of xml formatting text around cells of names & items etc, but you might find that some of those cells you began with a double quote (e.g. ") will usually have a special open/close-quote character instead. These look like the real thing, but they won't be recognised as xml text indicators, so if e.g. your object name never gets initiated, you'll get this error.
In my case there was literally "no declaration in the base values folder" because the xml file wasn't in the base values folder, after selecting create new file, although the directory tree showed it to be in the values folder.
Find your xml file in the directory tree, select refactor, select move, and look at the path. If there's an invisible addition to the path, delete it back to the proper folder.
As showed in the picture above. Android Studio shows that I have two elements with the same +id in the same layout. But that is not true.
I would like to know why this happen.
Thanks
Arturo your answer solved the problem.
File -> Invalidate Cache/ Restart...-> Invalidate and Restart.
Thanks a lot.
I imported an Android project in Eclipse. Somehow, the layout editor does not open automatically when I open a layout! After I open it, it gives me the 'Graphical Layout' tab but it is still an empty frame! The only difference I see from my previuos projects is that the top drop-down menu has an option called "Locale" while the older ones had "Any locale".
Please advise.
Restart eclipse. I always close eclipse when this error happens and restarting it after that and my problem got resolved.
Something similar happened to me today and I found that if I closed the window/tab and opened again a few times it fixed itself. It was annoying though. Also try going into the xml tab and edit something in there and go back to the Graphical Layout.
Something similar happened to me a few versions of ADT for eclipse ago.
EDIT
Ok it has just happened to me once again. What I did to resolve was to change the Android version to something else. It's the drop down box beside the Create... button. That made it reappear
I have the same problem, it goes away if I switch to XML view and make a single edit, and then save. Then switch back to graphical layout and the error is gone.
It wasn't working for me no matter what I did. But it started working again when I deleted a bunch of projects in my workspace. My theme for eclipse was also deleted when I did this too, I'm not sure why.