04-08 18:17:48.468: ERROR/AndroidRuntime(20955): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example/com.example.demo.GestureEvent}: java.lang.ClassNotFoundException: com.example.demo.GestureEvent in loader dalvik.system.PathClassLoader@4485c9a8
04-08 18:17:48.468: ERROR/AndroidRuntime(20955): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2497)
(ZygoteInit.java:618)
.............
============================
响应的配置文件
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example"
- android:versionCode="1"
- android:versionName="1.0">
- <uses-sdk android:minSdkVersion="7" />
- <application android:icon="@drawable/icon" android:label="helloworld">
- <activity android:name=".demo.GestureEvent">//error
- <activity android:name="com.android.demo.GestureEvent">//right
- <intent-filter>
- <action android:name="android.intent.action.MAIN"></action>
- <category android:name="android.intent.category.LAUNCHER"></category>
- </intent-filter>
- </activity>
- </application>
- </manifest>
关键代码
<activity android:name=".demo.GestureEvent">
对于 action 为MAIN 且 category 为LAUNCHER 的
且 与所指定的 package="com.example" 不一致的activity 来说
-----------------------------------------------------
android:name 需要配置成 全路径
<activity android:name="com.android.demo.GestureEvent">
否则将会抛出如上异常