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
Since Android Studio 3.5 or 3.6
I started getting the Default Activity not found
and I became tired of Invalidating Caches & Restart
, rebuilding project etc.
It turned out, the way I handle multi-modules and manifests was erroneous. I had the default Activity's Manifest in library module only, but it should've been in both app modules.
Assuming librarymodule
appmodule1
appmodule2
HomeActivity
from librarymodule
Manifest whatsoever.class AppModuleActivity1 : HomeActivity() to appmodule1
class AppModuleActivity2 : HomeActivity() to appmodule2
appmodule1
Manifest inside application
tag, I added: <activity
android:name="com.app.name.AppModuleActivity1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
appmodule2
but change 2 for 1 in naming.Error: Default Activity Not Found
I solved this way
Run>>Edit Configuration >>Android Application >> Enter the path of your default
activity class in "Launch" Edit Box.
I can't comment on why the upgrade of IntelliJ might cause this problem because I don't use it.
However, that error: "Default Activity Not Found" seems to be telling you that you don't have an activity declared in AndroidManifest.xml that is marked as the main activity, to be launched when the application starts.
You should have at least one activity that looks something like this:
<activity
android:name="com.your.package.name.YourActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If you don't have at least one activity with an intent filter like that, you would most likely see the error message you have included here.
You should add that intent filter to the Activity that you wish to open when you start the application, and that should fix your problem.
If you are working on a widget app this solution should work for you:
Edit Configuration
Launch Option
to nothing
In Android Studio under Run/Debug Configuration -> Android Application -> General -> Activity -> select the option "Do not launch Activity".
Exit Android Studio.
Go to path C:\Users\YOUR_WINDOW_USER_NAME\.AndroidStudio3.3\system
Remove /caches folder and /tmp folder