skip to Main Content

New android studio version android-studio-2021.1.1.11, tried creating sample empty Android app, its showing this error.

I am trying this with KOTLIN

Could not identify launch activity: Default Activity not found

Error while Launching activity.

AndroidManifest.xml contains below:

<?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>

any solution to get out from that error, android app not opening due to that error.

I am a beginner. please give solution in detail

2

Answers


  1. **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>
    
    Login or Signup to reply.
  2. You need to declare you activity in your manifest file.

    <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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search