parseSdkContent失败无法初始化类android.graphics.Typeface

Laz*_*azy 36 eclipse android nullpointerexception android-layout

当我打开布局编辑器时,eclipse会给出这个错误:

parseSdkContent failed
Could not initialize class android.graphics.Typeface
Run Code Online (Sandbox Code Playgroud)

当我尝试运行项目时,它会给出这个错误:

An internal error occurred during: "Launching myapp".
java.lang.NullPointerException
Run Code Online (Sandbox Code Playgroud)

每次我收到此错误,我都要重启eclipse.有什么解决方案吗?这个问题今天突然开始.


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>
Run Code Online (Sandbox Code Playgroud)

错误图片: 在此输入图像描述

Laz*_*azy 88

我删除了home/.android文件夹,现在一切正常.

Windows中,您可以在中找到此文件夹C:/Users/User/

资料来源:https://stackoverflow.com/a/5883841/3681056

注意:如果您有两个版本的SDK和eclipse,它们都在同一台计算机上(并使用相同的.android文件),如果您在版本上打开,则另一个版本会出现此错误.

  • 但要小心 - 您的.android文件夹包含您的AVD,调试密钥库等.您可能希望将其移动到其他位置. (8认同)