parseSdkContent 失败无法初始化类 android.graphics.Typeface
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24636393/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
parseSdkContent failed Could not initialize class android.graphics.Typeface
提问by Lazy
When I open layout editor, eclipseis giving this error:
当我打开布局编辑器时,eclipse给出了这个错误:
parseSdkContent failed
Could not initialize class android.graphics.Typeface
And when I try to run project, it is giving this error :
当我尝试运行项目时,它给出了这个错误:
An internal error occurred during: "Launching myapp".
java.lang.NullPointerException
Every time I'm getting this error and I have to restart eclipse. Is there any solution? This problem started suddenly today.
每次我收到此错误时,我都必须重新启动 eclipse。有什么解决办法吗?这个问题今天突然开始。
XML file:
XML文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66000000"
>
<RelativeLayout
android:id="@+id/refresh_match_layout"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_centerInParent="true"
android:layout_margin="15dp"
android:background="@drawable/app_detay_lay_bg"
android:orientation="vertical"
android:padding="10dp"
android:visibility="visible" >
<ImageView
android:id="@+id/app_icon"
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="10dp"
android:textColor="#ffffff"
android:textSize="20sp" />
<TextView
android:id="@+id/app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:textColor="#000000"
android:layout_toRightOf="@+id/app_icon"
android:layout_marginTop="2dp"
android:textSize="20sp" />
<ImageButton
android:id="@+id/app_detail_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="2dp"
android:background="@null"
android:src="@drawable/settings_detail"/>
<ImageButton
android:id="@+id/app_remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/app_icon"
android:layout_alignTop="@+id/app_detail_button"
android:background="@null"
android:src="@drawable/settings_remove" />
</RelativeLayout>
</RelativeLayout>
Error picture:
错误图片:
回答by Lazy
I deleted the home/.android
folder and everything is normal now.
我删除了home/.android
文件夹,现在一切正常。
In Windowsyou can find this folder in C:/Users/User/
在Windows 中,您可以在C:/Users/User/
Source: https://stackoverflow.com/a/5883841/3681056
来源:https: //stackoverflow.com/a/5883841/3681056
Note: it happens when you have 2 versions of SDK and eclipse, both in the same computer (and using the same .android file), if you open on version the other will get this error.
注意:当您在同一台计算机上有 2 个版本的 SDK 和 eclipse(并使用相同的 .android 文件)时,会发生这种情况,如果您打开另一个版本,则会出现此错误。
回答by Muhammad Soliman
Deleting ".android" is temporarily fixing the problem with me as after sometime it begins to come again ..
删除“.android”暂时解决了我的问题,因为一段时间后它开始再次出现..
Here is another cause and fix that might help .. This is happening because of existence of 2 versions of SDK in the same machine but in case you have only one version (probably it is 21) just download the SDK platform for API 20 (4.4W) as there is a problem in 21's "layoutlib.jar"). start applying the following:
这是另一个可能有帮助的原因和修复。这是因为在同一台机器上存在 2 个版本的 SDK,但如果您只有一个版本(可能是 21),只需下载 API 20 (4.4) 的 SDK 平台W),因为 21 的“layoutlib.jar”中存在问题)。开始应用以下内容:
Close Eclipse
Navigate to your sdk folder (something like C:\adt-bundle-windows-x86_64-20140321\sdk)
Go to platforms folder -> android-21 folder -> data folder and rename layoutlib.jar (for backup only)
Copy the same file (layoutlib.jar) from your android-20 folder to this folder "android-21"
Start Eclipse
关闭日食
导航到您的 sdk 文件夹(类似于 C:\adt-bundle-windows-x86_64-20140321\sdk)
转到平台文件夹 -> android-21 文件夹 -> 数据文件夹并重命名 layoutlib.jar(仅用于备份)
将相同的文件 (layoutlib.jar) 从您的 android-20 文件夹复制到此文件夹“android-21”
启动日食
回答by Pythonoid
deleting home/.android is useless, i delete ~/.android/avd it worked for me :)
删除 home/.android 没用,我删除了 ~/.android/avd 它对我有用:)
回答by muasif80
I was getting this error too
我也收到这个错误
parseSdkContent failed Could not initialize class android.graphics.Typeface
parseSdkContent 失败无法初始化类 android.graphics.Typeface
But I could only resolve it after changing my Eclipse ADT from 64 bit to 32 bit on Windows 7 64 bit OS.
但是我只能在 Windows 7 64 位操作系统上将我的 Eclipse ADT 从 64 位更改为 32 位后才能解决它。