我已经研究了一段时间了,但我遇到了一个我无法弄清楚的错误。我的小部件开始正常并正在更新(我遇到了画布引发回收位图错误的问题)所以我清理了我的项目,现在它无法运行。日志是:
12-21 00:49:18.967: E/AndroidRuntime(4967): FATAL EXCEPTION: main
12-21 00:49:18.967: E/AndroidRuntime(4967): java.lang.RuntimeException: Unable to instantiate receiver com.radicaldreamgames.WidgetrisWidget: java.lang.ClassNotFoundException: com.radicaldreamgames.WidgetrisWidget
12-21 00:49:18.967: E/AndroidRuntime(4967): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2202)
12-21 00:49:18.967: E/AndroidRuntime(4967): at android.app.ActivityThread.access$1500(ActivityThread.java:134)
12-21 00:49:18.967: E/AndroidRuntime(4967): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
12-21 00:49:18.967: E/AndroidRuntime(4967): at android.os.Handler.dispatchMessage(Handler.java:99)
12-21 00:49:18.967: E/AndroidRuntime(4967): at android.os.Looper.loop(Looper.java:137)
12-21 00:49:18.967: E/AndroidRuntime(4967): at android.app.ActivityThread.main(ActivityThread.java:4697)
12-21 00:49:18.967: E/AndroidRuntime(4967): at java.lang.reflect.Method.invokeNative(Native Method)
12-21 00:49:18.967: E/AndroidRuntime(4967): at java.lang.reflect.Method.invoke(Method.java:511)
12-21 00:49:18.967: E/AndroidRuntime(4967): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
12-21 00:49:18.967: E/AndroidRuntime(4967): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
12-21 00:49:18.967: E/AndroidRuntime(4967): at dalvik.system.NativeStart.main(Native Method)
12-21 00:49:18.967: E/AndroidRuntime(4967): Caused by: java.lang.ClassNotFoundException: com.radicaldreamgames.WidgetrisWidget
12-21 00:49:18.967: E/AndroidRuntime(4967): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-21 00:49:18.967: E/AndroidRuntime(4967): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-21 00:49:18.967: E/AndroidRuntime(4967): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-21 00:49:18.967: E/AndroidRuntime(4967): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2197)
12-21 00:49:18.967: E/AndroidRuntime(4967): ... 10 more
这是清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.radicaldreamgames.widgetris"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
-
<activity
android:name="StartActivity"
android:theme="@android:style/Theme.NoDisplay" >
-
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".ButtonServices"
android:enabled="true" />
-
<receiver
android:name="com.radicaldreamgames.WidgetrisWidget"
android:label="@string/app_name"
android:enabled="true" >
-
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widgetris_widget_provider" />
</receiver>
</application>
</manifest>