I upgraded IntelliJ Idea from 12.0.4 to 12.10.
Now all the modules in my Android project give the error:
Error: Default Activity Not Found
I got this error.
And found that in manifest file in launcher activity I did not put action
and
category
in intent filter.
Wrong One:
<activity
android:name=".VideoAdStarter"
android:label="@string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</activity>
Right One:
<activity
android:name=".VideoAdStarter"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
All answers above didn't help me. Try to remove this
<?xml version="1.0" encoding="utf-8"?>
in your AndroidManifest. Then:
File > Sync Project with Gradle Files
I have the same problem in Android Studio 3.3 Canary 3. Project from Android Studio 3.0 stabile version works firstly correctly, than after some cleans/rebuilds it starts showing No Default Activity error. I tried to reinstall this alpha version of Android Studio: error again. But then started it in old stabile Android, and using apk install, and this apk works correctly.
Moreover my project was created with Instant App (base, feature, instant, app subdirectories). I think this Android Studio has some problems with Manifest.xml files separated into this multiple directories.
So I have changed in settings to this:
just faced this error on android studio 2.1.2. solved by adding MAIN/LAUNCHER intent-filter to default activity in flavour manifest, though filter already was in default activity in default manifest. It even was in merged manifest, but studio can't found it until i duplicated filter in both manifests.
In Android Studio 4.0 please change Launch to Nothing:
Run/Debug Configuration -> Android App -> app -> General -> Launch Options -> Launch : Nothing
I found this in my code:
<context android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</context>
If you look very carefully, it should be <activity android:name=".MainActivity">
instead.
Apparently, I refactored an "activity" somewhere, and it changed names in the AndroidManifest as well.