Widget - cannot activate receiver

I know that similar questions were asked, but no one helped me. If I pointed to a link that has a solution, I would be more than happy. In any case, I get an error every time I install a widget that I am developing on my Android emulator.

Error status
ERROR / AndroidRuntime (866): java.lang.RuntimeException: cannot create an instance of recipient com.ifractal.firstwidget.FirstWidget: java.lang.NullPointerException

Here is the relevant code

AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ifractal.firstwidget" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <receiver android:name=".FirstWidget" android:label="@string/app_name"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> <action android:name="android.appwidget.action.APPWIGET_ENABLE" /> </intent-filter> <meta-data android:name="android.appwidget.provider" android:resource="@xml/provider" /> </receiver> </application> 

and here is my project layout in eclipse (to show that there are files) 9yR0B.png

I tried to recreate the project with a different name, cleaning / construction and a few other things, but nothing worked. I appreciate any help you can give me, and I would like to provide additional information if necessary. Thanks.

+4
source share
1 answer

the manifesto looks good to me. You get NPE in FirstWidget, so you need to learn this class. Check the stack trace and see exactly where the exception is thrown. Could it be a constructor?

+1
source

All Articles