2010-10-13 46 views
0

我有一个我开发的小部件,它在我的模拟器上运行良好。但是,当我去和我的设备上运行它,它没有出现在列表中显示出来找不到启动器活动!对于一个小部件?它是否必须是一个活动

下面是我的控制台说:

[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! 

我可以看到,确实应用程序包是我的设备上通过应用程序管理器。

我见过的其他职位上的SO: Android sample app not showing up launching android widgetFirst Android Test Project does not start

但我有一个小部件。那是不一样的?这里是我的AndroidManifest.xml,确实有一个Launcher定义。

<?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" /> 

+0

是您的Epic4g设备指定为“D70068f58fd3”的设备? – 2010-10-13 23:45:55

+0

是的。这是否意味着什么? – 2010-10-14 00:08:18

+0

@ b-ryce:突发奇想,尝试重新启动手机。我们已经看到设备存在太积极的缓存问题。当主屏幕活动第一次运行时,Epic可能只会读取可能的小部件的名单。如果事实证明是这样的话,您会在重启时看到您的小部件作为选项。如果这有效,请@我回来,因为我试图确保将来不会出现类似问题。谢谢! – CommonsWare 2010-10-14 00:27:09

回答

0

在你的XML清单您配置了接收器,而不是一项活动。 尝试类似的东西

<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>