android - 运行“应用程序”时出错:未找到默认活动
问题描述
我确实在这里找到了多种解决方案,但它们都不适合我……我克隆了一个现有的 Androi 项目,它工作得非常好,我添加并更改了一些代码,添加了片段和片段的资源。这样做时,一切正常,但突然我得到了这个错误......
我尝试了几件事: 1. 在“编辑配置”中将“默认活动”更改为特定活动,但我得到的错误是它未在 AndroidManifest.xml 中指定(它是)。2.我尝试在清单中使用完整的包路径(“com.example.something.ActivityLogin”而不是“.ActivityLogin”)
<activity android:name=".ActivityLogin"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- 无效的缓存并重新启动
- 尝试重新安装 Androi Studio
现在是最疯狂的一个: 5. 删除整个项目,从 git 中拉出 master,问题仍然存在!
另外,我根本没有触及 AndroidManifest 和 ActivityLogin,我没有重构任何东西......
我不知道该往哪里看,我猜这是与 Android Studio(2018 年 10 月 9 日起为 3.2.1)相关的问题?此外,另一个项目继续运行良好......
解决方案
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
构建-清理项目或构建-重建项目
推荐阅读
- c# - API 入口点无法识别 JSON (TypeScript) 的元组数组
- sql - SQL Server 从自定义分隔文本创建行
- java - Spring @Sql 注释在 UTC 中插入 MySQL 时间戳
- azure-devops - Release.Environments.{Stage}.Status 始终为“InProgress”
- python - 从文件 Python 重新加载函数后,仍然使用旧版本
- javascript - 对 Jest 测试文件进行 linting 时,eslint 会抛出 `no-undef` 错误
- sails.js - Sails.js find 不能与 or 和 select 一起使用
- sql - 如何修复 postgres 上的“SQLSTATE [42883]:未定义函数:7 错误”?
- r - 获得两个值之间成对最大值的矩阵的有效方法
- android - HERE 地图:Android N 中 setLocale 后 RouteOptions 的语言保持系统语言