Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No launcher activity found! Can't get widget to work

I've created an app widget that has the following classes and xml files: AFBWidget.java

WidgetConfig.java (Configuration screen for users to input something into a textfield that shows up in the widget layout)

widget.xml (the layout of the actual widget)

widgetconfig.xml (same as widgetconfig.java ((except it is the actual layout)))

widget_stuff.xml (the android appwidget provider)

Here is my Manifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.awesomefilebuilderwidget"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="18" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

<receiver android:name=".AFBWidget" android:label="@string/app_name">
<intent-filter>
    <action android:name="android.appwidet.action.APPWIDGET_UPDATE"/>
</intent-filter>

    <meta-data android:name="android.appwidget.provider"
    android:resource="@xml/widget_stuff"/>

</receiver>

<activity android:name=".WidgetConfig" android:label="@string/app_name">
<intent-filter>
    <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/> 
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />

</intent-filter>

</activity>

<activity android:name=".widget" 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>

Originally, I didn't have the .widget activity in there and I didn't have the

            <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />

either, so I got the error "No laucher activity found!". So to fix that, I added the launcher to my appwidget config and it fixed the error but then the widget would stop working and force close on the emulator.

My issue is that I don't know what activity to put the launcher on to make the widget work without crashing.

New Errors:

10-06 08:58:29.448: D/AndroidRuntime(6994): Shutting down VM
10-06 08:58:29.448: W/dalvikvm(6994): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
10-06 08:58:29.458: E/AndroidRuntime(6994): FATAL EXCEPTION: main
10-06 08:58:29.458: E/AndroidRuntime(6994): java.lang.RuntimeException: Unable to instantiate receiver com.example.awesomefilebuilderwidget.AFBWidget: java.lang.ClassNotFoundException: com.example.awesomefilebuilderwidget.AFBWidget in loader dalvik.system.PathClassLoader[/data/app/com.example.awesomefilebuilderwidget-1.apk]
10-06 08:58:29.458: E/AndroidRuntime(6994):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2012)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at android.app.ActivityThread.access$2400(ActivityThread.java:135)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1101)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at android.os.Looper.loop(Looper.java:150)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at android.app.ActivityThread.main(ActivityThread.java:4333)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at java.lang.reflect.Method.invokeNative(Native Method)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at java.lang.reflect.Method.invoke(Method.java:507)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at dalvik.system.NativeStart.main(Native Method)
10-06 08:58:29.458: E/AndroidRuntime(6994): Caused by: java.lang.ClassNotFoundException: com.example.awesomefilebuilderwidget.AFBWidget in loader dalvik.system.PathClassLoader[/data/app/com.example.awesomefilebuilderwidget-1.apk]
10-06 08:58:29.458: E/AndroidRuntime(6994):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-06 08:58:29.458: E/AndroidRuntime(6994):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2003)
10-06 08:58:29.458: E/AndroidRuntime(6994):     ... 10 more
10-06 08:58:36.535: W/dalvikvm(7066): threadid=1: thread exiting with uncaught exception (group=0x4001d5a0)
like image 859
user1628978 Avatar asked Oct 05 '13 17:10

user1628978


1 Answers

I FINALLY FIXED IT AFTER 3 DAYS! Ok, so it was indeed because my two java classes were in a default package. So to fix that, since my classes were being accessed via a different package, I created a new package that was my app (com.example.awesomefilebuilderwidget) and then moved the classes into there and now it works with no problemos! :DD Thanks for all you've done I really do apperciate it! – user1628978

like image 199
user1628978 Avatar answered Oct 21 '22 09:10

user1628978