[英]No Launcher activity found! For a widget? Does it have to be an activity
我有一個已開發的小部件,它可以在模擬器上正常運行。 但是當我在設備上運行它時,它沒有顯示在列表中
這是我的控制台說的:
[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示例應用程序未顯示正在 啟動android小部件,並且First Android Test Project無法啟動
但是我有一個小部件。 那不一樣嗎 這是我的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" />
在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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.