5

Recently I updated my android studio to 3.2 but when the old open project I getting the error "default activity not found".

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

<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">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
kishan hadiyal
  • 91
  • 1
  • 2
  • 7

11 Answers11

25

None of the given solutions worked for me. The thing that worked for me was:

  • Exit Android Studio
  • Find AndroidStudio3.2 (or whatever your version is) folder
  • Go to AndroidStudio3.2 -> system -> caches
  • Delete that folder
  • Restart Android Studio

It will re-index your files and that thing will work

kirtan403
  • 7,293
  • 6
  • 54
  • 97
3

I solved the very same issue by doing this

Close Android Studio

deleting :

1 .android

2 .AndroidStudio

3 .gradle

from C:\Users\[your user name]

Start Android studio ( Will take some time to rebuild)

anwar alam
  • 582
  • 5
  • 19
2

It worked for me by adding the default activity in the configuration, Following these steps:

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.

1

Have you refactored it in anyway ? Trying doing :

  1. Cleaned the Project
  2. Deleted the Build directory
  3. Restarted Android Studio
  4. Rebuild the Project
  5. Run
Karzel
  • 928
  • 9
  • 24
1

I deleted .android under C:\Users[your user name] and all worked

Ugo Chirico
  • 347
  • 3
  • 6
0

I solved the very same issue by following steps

Close Android Studio

deleting from :

  1. C:\Users\your user name.android/log and gradle folder

  2. C:\Users\your user name.gradle

from C:\Users[your user name]

Restart Computer and run Android studio (it Will take some time to rebuild)

Ali Sidhu
  • 119
  • 9
0

All I did was disable offline mode and sync project

0

For future visitors with similar problem, I am just posting this incase if this turns out to be same problem for you. I tried everything mentioned here and yet none of them worked. Error: Default Activity Not Found

I am using Android Studio Stable 3.2.1 version and project is in Kotlin. I cloned project again and opened project freshly again after several Invalidate caches/Restart but din't help. Finally this 1 helped -> upgrading kotlin version in root .gradle file..from 1.3.10 to 1.3.11

In root gradle file

buildscript {
    ext.kotlin_version = '1.3.11'
    ext.annotation_version = "27.1.1"
    repositories {
        google()
        maven { url 'https://maven.fabric.io/public' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.0.2'
        classpath 'io.fabric.tools:gradle:1.+'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
Amit Tumkur
  • 2,752
  • 26
  • 27
0

File ->Invalidates Cache / Restart Solved my problem

Koussay
  • 174
  • 2
  • 8
0

I am experiencing this build error after setting a custom style in a manifest file.

android:theme="@style/AppTheme"

to

android:theme="@style/TransparentBackgroundApp"

Blazej SLEBODA
  • 8,936
  • 7
  • 53
  • 93
0

File -> Invalidate Caches / Restart... Then Sync Project with Gradle Files