简体   繁体   English

找不到启动器活动! 对于小部件? 它一定是一项活动吗

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

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 我在SO上看到了其他帖子: Android示例应用程序未显示正在 启动android小部件,并且First Android Test Project无法启动

But I have a widget. 但是我有一个小部件。 Is that different? 那不一样吗 And here is my AndroidManifest.xml, which does indeed have a Launcher defined. 这是我的AndroidManifest.xml,确实定义了启动器。

<?xml version="1.0" encoding="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. 在XML清单中,您配置了一个接收器而不是一个活动。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM