开发者

No Launcher activity found! For a widget? Does it have to be an activity

开发者 https://www.devze.com 2023-01-20 02:02 出处:网络
I have a widget that I\'ve developed and it runs fine on my emulator. But when I go to and run it on my device it doesn\'t show up in the list

I have a widget that I've developed and it runs fine on my emulator. But when I go to and run it on my device it doesn't show up in the list

Here is what my console says:

[2010-10-14 12:43:43 - MyWidget] No Launcher activity found!
[2010-10-14 12:43:43 - MyWidget] The launch will only sync the application package on the device!**
[2010-10-14 12:43:43 - MyWidget] Performing sync
[2010-10-14 12:43:43 - MyWidget] Automatic Target Mode: using device 'D70068f58fd3'
[2010-10-14 12:43:43 - MyWidget] Uploading MyWidget.apk onto device 'D70068f58fd3'
[2010-10-14 12:43:43 - MyWidget] Installing MyWidget.apk...
[2010-10-14 12:43:45 - MyWidget] Success!
[2010-10-14 12:43:45 - MyWidget] /MyWidget/bin/MyWidget.apk installed on device
[2010-10-14 12:43:45 - MyWidget] Done!

I can see that indeed the application package is on my device via the Applications manager.

I've seen the other posts on SO: Android sample app not showing up launching android widget and First Android Test Project does not start

But I have a widget. Is that different? And here is my AndroidManifest.xml, which does indeed have a Launcher defined.

<?xml version="1.0" encodi开发者_如何学运维ng="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.example.widget"
android:versionCode="1"
  android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    <receiver android:name=".MyWidget"
              android:label="Anything">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </receiver>

</application>
<uses-sdk android:minSdkVersion="7" />


In your XML Manifest you have configured a receiver and not an activity. Try something like that

<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    <receiver android:name=".MyWidget"
              android:label="Anything">
    </receiver>
    <activity android:name="YourActivity" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
    </activity>
</application>
0

精彩评论

暂无评论...
验证码 换一张
取 消