错误:未找到默认活动,但已声明

Ser*_*kov 3 android kotlin android-studio

我有两次困扰我的奇怪情况.

我在我的主模块中显示 - igs_main

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools" package="com.example">

    <application
            android:name=".CommonApplication"
            android:allowBackup="false"
            android:label="@string/app_name"
            android:hardwareAccelerated="true"
            android:networkSecurityConfig="@xml/network_security_config"
            android:theme="@style/AppTheme"
            android:supportsRtl="false"
            tools:replace="android:supportsRtl,android:allowBackup"
            tools:ignore="GoogleAppIndexingWarning, UnusedAttribute, RtlSupport">

        <activity android:name=".auth.view.SplashScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

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

</manifest>
Run Code Online (Sandbox Code Playgroud)

当我试图启动我的应用程序时,它看起来像

在此输入图像描述

我收到一个错误:

在此输入图像描述

我试着直接指定我的默认Activity,但是AS表示此活动未在Manifest中声明.

在此输入图像描述

然后我尝试了Invalidate Caches and RestartAS和Rebuild项目,但它也没有帮助我.

所以,我浪费所有可能的解决方案.谁知道如何解决?

Ser*_*kov 5

我不知道为什么它可以链接到这个问题,但这个问题的原因来自Kotlin编译器.当我启动Kotlin编译器选项时,我看到了警告,经过几秒钟的谷歌搜索,我找到了一个答案,在这里描述 - /sf/answers/3563899741/.

改变后useProjectSettingstrue都成了正常工作!

为防止信息丢失,我将原始代码段复制粘贴到此处.

<facet type="kotlin-language" name="Kotlin">
  <configuration version="3" platform="JVM 1.6" useProjectSettings="true">
    <compilerSettings />
    <compilerArguments>
      <option name="destination" value="$MODULE_DIR$/build/tmp/kotlin-classes/debug" />
      <option name="noStdlib" value="true" />
      <option name="noReflect" value="true" />
      <option name="moduleName" value="app_debug" />
      <option name="addCompilerBuiltIns" value="true" />
      <option name="loadBuiltInsFromDependencies" value="true" />
      <option name="languageVersion" value="1.2" />
      <option name="apiVersion" value="1.2" />
      ...
    </compilerArguments>
  </configuration>
</facet>
Run Code Online (Sandbox Code Playgroud)

你必须阅读下面的文字

但问题仍在继续.更少,但来了.有一天我正在编辑xml文件,我发现了破坏的APPT.所以问题出在SDK中,我删除并再次安装.在此之后一切正常.