簡體   English   中英

我經常發現此特定錯誤:“無法識別啟動活動:找不到默認活動啟動活動時出錯”

[英]I often found this specific error: “Could not identify launch activity: Default Activity not found Error while Launching activity”

這是我安裝應用程序的adb shell命令,每次我安裝應用程序時,都會顯示未找到默認活動。

$ adb shell pm install -t -r "/data/local/tmp/it.dabbl"
    Success
    APK installed in 9 s 725 ms
    Could not identify launch activity: Default Activity not found
    Error while Launching activity

您必須在清單中定義啟動器活動。

  <activity
    android:name=".MainActivity" //Whatever Activity you want to launch first>
      <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
  </activity>

因此,在互聯網上搜索一個小時后,我從項目結構中檢查了我是否未設置默認配置設置。 要解決此問題,您必須打開項目結構,然后添加默認配置,然后與gradle同步將解決此問題。

我遇到了同樣的問題,並通過手動設置啟動活動來解決。 從菜單中選擇“運行->編輯配置...”,然后在“啟動選項”下選擇“啟動:指定活動”和“活動:your.launch.activity”,其中“ your.launch.activity”是活動您要啟動。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM