简体   繁体   中英

xml error in Eclipse after updating Android SDK Tools

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 .

我在几分钟之前就遇到了同样的问题,尝试降低API级别,按布局编辑器屏幕中的andorid绿色图标,然后在下拉菜单中选择API 7.我认为这样可以解决问题。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM