启动应用程序时出错:找不到默认 activity - 两次中有一次

Error launching app : Default activity not found - One out of two times

我正在使用 Android Studio。 当我启动我的应用程序时,出现错误 Default activity not found.
我知道 Sync Project with Gradle Files 方法,它有效,但每次我想启动我的应用程序时都需要使用它。

我也试过Invalidate Cache and Restart,但是没有解决任何问题

这是我的一部分 AndroidManifest.xml :

<activity android:name="com.discodery.android.discoderyapp.SplashActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

有没有办法彻底解决这个问题?

我也有像这样的奇怪错误(不会取消构建):

companion object {
    fun getStartIntent(context: Context) : Intent = Intent(context, MessageSentActivity::class.java)
}

那么在这个例子中,行尾的java字是红色的,说Unresolved reference : java

我想我的编辑器坏了,但我今天下午卸载了它,它一直给我这些错误。

谢谢。

问题解决了! 这是我所做的:

  • 已卸载 Android Studio,(勾选方框 "Remove user data")
  • 重新安装
  • 已根据建议将 ext.kotlin_version 更新为 1.3.21 dastan
  • 已删除 app/build 目录
  • 清理项目
  • 重建项目

我认为是 kotlin 版本抛出了这个异常。感谢达斯坦的回答!