-1

I have created a new project in android studio and when i am trying to run it ,it is saying default activity not found.i have checked my manifest file this does not contain any problem. there is a Red X Mark android studio application while running

priya kushwah
  • 29
  • 1
  • 1
  • 6

7 Answers7

16

Exit Android Studio.

Go to path > C:\Users\YOUR_WINDOW_USER_NAME\.AndroidStudio3.3\system

Remove /caches folder.

Make sure

  • you have defined Launcher activity in Manifest file for one Activity

  • you have set the default activity from Configurations

  • you have set the selected activity from Configurations.

Community
  • 1
  • 1
pooja jardosh
  • 289
  • 2
  • 4
4

There is a work around to make it work that worked for me.

1- Select Edit Configurations from the drop down next to run button.

2- Under launch options > Launch select Specified activity.

3- Another field "Activity" will appear select your default activity.

4- Click OK and sync project with gradle files and it should work.

  • i have follwed these steps but that does not work .i have got solution of my problem that i uninstall android studio and reinstall it now it is working fine. – priya kushwah Dec 02 '18 at 15:05
2

two Method for solving this problem

Method 1.make sure that default activity is define in your manifest

Method 2. even default activity is define but not solved than go to your manifest file click on merged Manifest at bottom left side of your manifest file and you will see the side drawer menu of your manifest file you will see the error and from there you can solved your error by click on suggestion.

1

Check the manifest file and under the activity tags make sure it has:

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".Activity_name Here"
            android:label="@string/app_name" >
            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

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

Make sure that the line containing the action android:name= "android.intent.action.MAIN" is included in the activity tag of the application.

Also make sure that activity name is corresponding to the android:name of the activity.

kale
  • 151
  • 1
  • 10
Jess
  • 28
  • 5
0

Try to check this code..

  <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

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

Check whether your Launcher activity intent filter has this

tools:node="remove"

If yes, remove it and error will be resolved. This piece of code will be used when we are having flavors in our project structure, in-order to remove a Launcher activity.

Else, Two launcher icons will be installed.

Kanagalingam
  • 2,096
  • 5
  • 23
  • 40
-1

i have resolved this issue by changing the location of android studio from program files to program filesx86

priya kushwah
  • 29
  • 1
  • 1
  • 6