Java 如何修复Android中的ClassNotFoundException
我已经尝试在android上实现TabHost好几天了,但我遇到了一个错误。我删除了我的核心tabhost代码,我仍然有相同的错误。我想这是我的manifest.xml。基于我的错误消息,我查找了源清单,但找不到它 错误Java 如何修复Android中的ClassNotFoundException,java,android,android-tabhost,Java,Android,Android Tabhost,我已经尝试在android上实现TabHost好几天了,但我遇到了一个错误。我删除了我的核心tabhost代码,我仍然有相同的错误。我想这是我的manifest.xml。基于我的错误消息,我查找了源清单,但找不到它 错误 E/AndroidRuntime(32386):原因:java.lang.ClassNotFoundException:在路径:/system/framework/com.google.android.maps.jar:/data/app/com.sysdisc.mobile.
E/AndroidRuntime(32386):原因:java.lang.ClassNotFoundException:在路径:/system/framework/com.google.android.maps.jar:/data/app/com.sysdisc.mobile.hangmessage-1.apk上未找到类“android.view.FragmentLayout”
代码
这是我的xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FragmentLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<ListView android:id="@+id/list1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
</ListView>
<ListView android:id="@+id/list2" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
</ListView>
</FragmentLayout>
</LinearLayout>
转到您的
项目属性>Java构建路径>订单和导出>
确保选择了com.google.android.maps.jar
然后清理并重建您的项目。因此我遵循了您的解决方案。还有同样的问题。。。。我应该给你manifest.xml吗?不,manifest没有问题。确保已单击android专用库。您正在使用的任何外部jar都会按顺序单击并导出。另外,在您选择maps.jar并进行清理之后,您的错误消息是否发生了更改?是的,是的。我刚刚发现错误指示setContentView(R.layout.message\u history\u整个布局);在我的日志上:由以下原因引起:android.view.InflateException:二进制XML文件行#20:膨胀类碎片布局时出错
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FragmentLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<ListView android:id="@+id/list1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
</ListView>
<ListView android:id="@+id/list2" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1">
</ListView>
</FragmentLayout>
</LinearLayout>