我做所有事情,研究每一个但仍然没有工作。我从这里读了很多页但没有:(
我尝试了所有解决方案。
错误日志:
03-20 14:46:49.627: I/Process(1895): Sending signal. PID: 1895 SIG: 9
03-20 14:46:59.608: E/Trace(1937): error opening trace file: No such file or directory (2)
03-20 14:46:59.608: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:46:59.608: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:46:59.608: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:46:59.707: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:46:59.707: W/Trace(1937): Unexpected value from nativeGetEnabledTags: 0
03-20 14:47:00.207: D/AndroidRuntime(1937): Shutting down VM
03-20 14:47:00.217: W/dalvikvm(1937): threadid=1: thread exiting with uncaught exception (group=0xb5dcc908)
03-20 14:47:00.327: E/AndroidRuntime(1937): FATAL EXCEPTION: main
03-20 14:47:00.327: E/AndroidRuntime(1937): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.panetest/com.example.panetest.PaneTest}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.os.Handler.dispatchMessage(Handler.java:99)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.os.Looper.loop(Looper.java:137)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-20 14:47:00.327: E/AndroidRuntime(1937): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 14:47:00.327: E/AndroidRuntime(1937): at java.lang.reflect.Method.invoke(Method.java:511)
03-20 14:47:00.327: E/AndroidRuntime(1937): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-20 14:47:00.327: E/AndroidRuntime(1937): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-20 14:47:00.327: E/AndroidRuntime(1937): at dalvik.system.NativeStart.main(Native Method)
03-20 14:47:00.327: E/AndroidRuntime(1937): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-20 14:47:00.327: E/AndroidRuntime(1937): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Activity.setContentView(Activity.java:1881)
03-20 14:47:00.327: E/AndroidRuntime(1937): at com.example.panetest.PaneTest.onCreate(PaneTest.java:16)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Activity.performCreate(Activity.java:5104)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-20 14:47:00.327: E/AndroidRuntime(1937): ... 11 more
03-20 14:47:00.327: E/AndroidRuntime(1937): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.example.panetest.FirstPane: make sure class name exists, is public, and has an empty constructor that is public
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Fragment.instantiate(Fragment.java:592)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Fragment.instantiate(Fragment.java:560)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Activity.onCreateView(Activity.java:4709)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-20 14:47:00.327: E/AndroidRuntime(1937): ... 21 more
03-20 14:47:00.327: E/AndroidRuntime(1937): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.panetest.FirstPane" on path: /data/app/com.example.panetest-1.apk
03-20 14:47:00.327: E/AndroidRuntime(1937): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-20 14:47:00.327: E/AndroidRuntime(1937): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-20 14:47:00.327: E/AndroidRuntime(1937): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-20 14:47:00.327: E/AndroidRuntime(1937): at android.app.Fragment.instantiate(Fragment.java:582)
03-20 14:47:00.327: E/AndroidRuntime(1937): ... 24 more
activity_pane_test.xml
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/slidingpanelayout">
<fragment android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.panetest.FirstPane"
android:id="@+id/fragment_firstpane"/>
<fragment android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.panetest.SecondPane"
android:id="@+id/fragment_secondpane"/>
PaneTest.java
package com.example.panetest;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.widget.SlidingPaneLayout;
import android.view.Menu;
public class PaneTest extends Activity {
SlidingPaneLayout pane; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pane_test);
pane = (SlidingPaneLayout) findViewById(R.id.slidingpanelayout);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.pane_test, menu);
return true;
}
}
的AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.panetest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.panetest.PaneTest"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
请任何人提供解决方案。
答案 0 :(得分:1)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.panetest.FirstPane" on path: /data/app/com.example.panetest-1.apk
您的项目似乎在包FirstPane
中没有类com.example.panetest
。