新android studio版本android-studio-2021.1.1.11,尝试创建示例空android应用程序,显示此错误
我正在尝试使用KOTLIN
无法识别启动活动:默认活动未找到
启动活动时出错。
AndroidManifest.xml包含以下内容:
<?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/Theme.MyApplication" /> </manifest>
任何解决方案来摆脱这个错误,android应用程序无法打开由于这个错误。
我是初学者。请给出详细的解决方案
**Check your manifest.. you are probabaly missing the intent filter that I have shown in snippet.**
<activity
android:label="main"
android:name=".mainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
你需要在manifest文件中声明你的activity
<application
android:allowBackup="false"
android:icon="@drawable/logo"
android:label="App Name"
android:roundIcon="@drawable/logo"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:theme,android:allowBackup,android:label"
tools:targetApi="m">
<activity android:name="com.app.ui.YourActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
// Your other activities go here