xml error in Eclipse after updating Android SDK Tools - android

This is the error I'm getting in my layout XML files:
error!
NotFoundException: null
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- TextView (Change to android.widget.TextView, Fix Build Path, Edit XML)
This happened after updating my SDK tools in Eclipse. However, I can still compile my code, I just can't see the graphical part of my layout.
Recently, I also added the RootTools library, could that also be the cause?
Thank you!

I had the same problem. And it turned out to be a very strange thing.
In my strings.xml file I had a line
<string name="email_seperator_char">\#</string>
And this was causing the problem. Even if I use the escape character for # sign preview was not working after SDK update.
SOLUTION:
I just added a space in front of it and voila, it worked.
<string name="email_seperator_char"> \#</string>
I know it is strange and it may not be acceptable for some apps to have an space infront of it. But that was ok for my app. Hope this helps.
And in design mode, in graphical layout, you have a new icon, (android icon), click and select 8 minimum.

I'm not sure it helps in your case, but I found out what was the problem with mine. To support older Android devices, I lowered my project build target to API level 7 (Android 2.1) from the previous value of API Level 8 (Android 2.2).
There might be an issue with the 2.1 layout renderer, it kept crashing on my TextView's property android:textAppearance="?android:attr/textAppearanceMedium". Even when I removed it, rendering was working but had a strange appearance (grey background, tiny black text). Switching the API level back fixed the layout editor straight away.
To change it, go to your project properties, select Android on the right, then tick the box next to your desired API level under Project Build Target.

I ve got the same issue just a minutes ago, try to lower the API level, press the andorid green icon in the layout editor screen and on the dropdown menu select API 7. I think it would be work out.

I've been having similar issues. After reading a number of these posts, I've found that there is probably a bug in the layout renderer for Android 4.0.3. An error message is listed (ROOT
Exception details are logged in Window > Show View > Error Log) even when all parts of the project are set to Android 4.0.3 and SDK 15.
If I set the layout renderer to Android 2.2 and leave everything else set to Android 4.0.3, SDK 15, then it all appears to work just fine.
I hope this is useful.

there is something wrong in your TextView
one time I wrote this which cause the problem
android:textAppearance="#android:attr/textAppearanceLarge"
the Eclipse can`t tell that is wrong but the design view crashes,when I realized that,I change # to ?
android:textAppearance="?android:attr/textAppearanceLarge"
then all comes to normal

Related

Android rendering xml issues in eclipse: Exception raised during rendering: java.util.Locale.toLanguageTag()Ljava/lang/String

My basic functionality and everything are working just fine but there is one thing that is troubling me.
Whenever I use an EditText field, the XML fails to render and nothing is displayed. The problem doesn't occur with any other field. I've been getting the following error:
Exception raised during rendering: java.util.Locale.toLanguageTag()Ljava/lang/String
Does anyone else face this issue?
It may be an issue with the API you have set in Eclipse.
If it is set to the Android Wear it may cause this problem.
In the xml Graphic Layout window, look for the android symbol in the top right corner.
There is a drop down arrow, which will list all of the API versions you can use. Check that it is now set to API 20(4.4W.2). You may need to change it to API 19 or API 20 L.
Hope that helps
In my case I was rendering for Android Wear , and that was causing the problem , setting it to API19 in design view , solved it
Clean Your Project and Rebuild.
2.Close Eclipse And Restart again.
3.its Working fine.

Upgraded eclipse now getting main.xml: NotFoundException: null - Saga continues

I looked up on getting an emulator for a tablet and noticed a suggested that on checking for updates within eclipse , the latest SDK/ADT etc would provide this. At the moment I cannot check this because I am getting the following error on my main.xml file.
error!
NotFoundException: null
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- ToggleButton (Change to android.widget.ToggleButton, Fix Build Path, Edit XML)
I have tried the three options it offers and on choosing edit XML nothing appears to show an error.
This project runs under Android 1.6 (wanted to make it as backward compatible as possible) and trying to cope with different screen sizes and orientations . At the moment I have the following layout folders:
layout(empty folder)
layout-large
layout-normal
layout-normal-land
layout-small
layout-xlarge
These all existing before the eclipse/android updates and I never had these errors. I searching the net on these , I read one suggestion of Project->clean (done this) and I then did Project->Build.
I also a suggestion to remove r.java so I have done this and ran clean and build. Still getting the same error. Oddly the code and the xml show no signs of errors apart from the above message appears at the bottom of the designer window for the XML.
The designer is set to 1.6 (API4) so it is not that the designer thinks I am on a different version to my project.
Update 1:
Since moving onto 2.1 - I found that although the layout does not show the error straight away, it then appears if I try and make any changes to it. Also I have updated the images and these do not appear to have changed either.
Update 2:
feco has suggested a reasonable suggestion of moving the build target to 2.1 as only a small percentage of users operate with a 1.6 handset now. I have decided to do this , it is more of a get around than a solution but it will have to do right now.
I had the same problem. I solved it by changing from API4 to API10 (or more) in the "Graphical Layout" window -> upper menu -> Android logo (green robot) at the end

Android: Graphical Layout not working - doesn't show anything

My situation is: I once made an android project(2.2 version) but soon needed to format my computer. After formatting, I downloaded eclipse again but when I imported my project, I wasn't able to use the 'graphical layout' menu for xml. It doesn't show me anything like the picture below.
http://img525.imageshack.us/img525/3586/19978552.png
I cleaned the project and updated the Android SDK, however, none of these seemed to work well. What could be causing this?
Try restarting Eclipse. Usually that solves the problem for me when that happens.
Right click on your layout xml file and select Open With -> Android Layout Editor. It will force eclipse to open file in android's layout editor mode
None of above worked for me. what worked for me is:
1- Select a Google APIs Project Build Target rather than one of the Android X.X ones. This setting is in right click on project -> Properties->Android.
2- Make a change in XML and save it. Now switch back to "Graphical Layout" and it will show the layout.
For some, only 2nd step works.
This Question was asked 3 year ago, I am sure that you have get your solution, however i was also facing the same problem but got the solution in eclipse, here it is:-
1)Goto help->AboutEclipse->Installation details.
2)check the version of Android DDMS, Android development tool, Android hierarchy viewer, Android native development tool, Android trace view and tracer for openGl ES in installed software tab.
3)If they have different version than you have to update all of them.
4)Goto help->check for update in eclipse and follow the instruction.
5)Then restart eclipse.
This solve my problem.
The topic seems a little bit cold, but I wanted to add it nonetheless.
I had a similar problem with my layouts recently. When i create a project it automatically creates the layouts in the latest version of Android (eclipse shows it as version 22 of android as of today). But i can't see anything. So i just change the version to, say 18, and it shows ok. Furthermore if i want to change it back to version 22 it throws and exception, saying that a class can't be instantiated. (I am probably missing a class or a library on my system.)
Therefore if you cant see the layout it might be a good idea to switch back to earlier versions for development. cheers.

Blank Graphical Layout?

I don't get this. I've searched everywhere and no one's answers have solved this for me.
Why does this keep happening? I can't do anything! The XML Code is still there, but it doesn't show anything in the Graphical Editor. The Palette comes up if I change it to "4in WVGA (Nexus S)" or some other configuration, but I still can't see anything and the Theme drop down menu is unselectable. All my XML documents are like that.
Just delete any custom device screen configuration you have added . It will solve the issue :)
That just happen to me and after some attempts I found the reason.
When I first opened the project in eclipse I found some errors related with the version of Java. I changed the JDK compliance to 1.6 (Project->Properties->Java Compiler) and all errors dissapear but all graphical layouts went blank.
I uncheked "Enable project specific settings" (Project->Properties->Java Compiler) and now all the graphical layouts are working.
When everything fails, close eclipse and start it all over again, it solved my problem.
I also had that problem, it happened to me when i imported my project. after some time I came to reason just change the workspace of eclipse to folder, which contains your folder.
I changed workspace on opening eclipse, there can be some other way as well
hope this will solve it
If it has never worked for you (or something went wrong upgrading your SDK, as in my case), you may need to install an extra package. For me the issue was fixed when I installed Android Native Development Tools under NDK Plugins (SDK version 20).
I had this problem since I switched the option Show previews in the palette. I switched to show only icons, everything is ok now.

Can't preview Android XML layout - LayoutLib is too recent. Update your tool?

After upgrading the Android SDK through the AVD manager, I cannot preview XML layouts any longer in eclipse for Android 2.2 previews. Eclipse says, "LayoutLib is too recent. Update your tool!"
Using the drop-down and choosing any other platform works fine. Why is this happening for Android 2.2 previews?
I have also updated the ADT plugin for ecplise as well. Any suggestions?
This is a bug: http://code.google.com/p/android/issues/detail?id=17369
Updating from 10.0.1 to 12.0.0 resolved this issue for me.
In Eclipse, Help --> Check for updates
You'll likely see three items to be updated to 12.0.0+. Install, restart Eclipse, and the layout view should display without error.
More of a fix than an answer, or a fix with no explanation: r-click on the res\layout*.xml file you want to open, select Open with, then select Android Layout Editor. That should open the .xml in the graphical layout/design view you're used to.
For whatever reason, after updating from 10.0.1 to 12.0.0, my layout viewer default changed to XML Editor (one of the options under the context menu referenced above), and I have to manually open with different editor. Opening manually selecting Android Layout Editor seems to set ALE as the default for that .xml file going forward.
I had the same issue. Went in Eclipse->Help->CheckforUpdates. Selected everything there and hit next. Keep hitting next until finish. The update will start at the bottom right hand corner. Will also ask for permission. Press "OK". Will restart eclipse and problem is solved. I guess there was a bug with ADT but whatever this update fixed it.

Categories

Resources