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