Java 活动';主要活动';虽然存在,但未在AndroidManifest.xml中声明
直到昨天它还可以正常工作,但今天当我尝试运行应用程序时,它说“运行应用程序时出错:找不到默认活动”Java 活动';主要活动';虽然存在,但未在AndroidManifest.xml中声明,java,android,android-activity,android-manifest,Java,Android,Android Activity,Android Manifest,直到昨天它还可以正常工作,但今天当我尝试运行应用程序时,它说“运行应用程序时出错:找不到默认活动” 试图通过在“编辑配置”选项中指定活动路径来解决此问题,但随后显示 活动“MainActivity”未在AndroidManifest.xml中声明 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" packa
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
尝试卸载并重新安装Android Studio 3.4,但仍然无法正常运行听起来像是Android Studio的bug。我自己也遇到过几次。删除缓存并重新启动studio。在此处查找更多引用:'
在build.gradle(模块)文件中添加代码
sourceset{
main.java.srcDirs+='src/main/'
}
我真的不知道为什么,但大多数时候我会做以下事情:
在第一个时刻,您应该看到左侧的所有内容都是空的,右侧的一些错误。在这一点上,有些时候,由于某种深奥的原因,问题消失了。如果没有,您将在右侧出现一些有意义的错误请发布mainactivity类发布您的完整清单文件也
您是否在清单标记中声明了该包?IntelliJ Amiya我尝试过,但它没有删除C:\Users\UserName.AndroidStudio3.4文件夹中的缓存文件夹,错误不再存在