[android] "Default Activity Not Found" on Android Studio upgrade

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 reverted back to 12.0.4 and it everything works again.

Any ideas? I think it might be an issue with a missing plugin. Since the plugin is not installed, it is not able to find the default activity. Another thing could have been a local config, but I doubt it. I deleted the configuration folder to verify and that didn't change anything.

This question is related to android intellij-idea android-studio

The answer is


ugly but worked for me:

Had this error message, my problem was in a module, I just deleted the application tag compleatly from my module's manifest and it worked.

(delete ic_launcher from the module library as well)

was:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mymodule"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="23" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
       >
        <activity
            android:name="com.example.mymodule.MainActivity"
            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>

</manifest>

now:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mymodule"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="23" />


</manifest>

I got this error for trying to run an app that didn't have an activity (it was an androidTest project). So I just right clicked on the test project, and selected Run or Debug from the context menu.


I tried Invalidate cache and restart, no luck. Then i verified manifest, it was having the main activity intent properly set.

I was having the 'Offline work' checked under Global Gradle Settings in File -> Settings -> Build, Execution, Deployment -> Gradle

I unchecked it, modified the build.gradle (Project) to use a different gradle version (com.android.tools.build:gradle:3.3.1) and saved it that triggered Gradle sync.

After sync'ing, this error was gone, i was able to debug again.


I had this problem for 2 days . Tried every possible solution but nothing worked .

Finally find a solution .

Here is what you need to do .

Close Android Studio

Go to C:\Users\UserName.android and rename the build-cache folder to build-cache.bak

Go to C:\Users\UserName.AndroidStudio3.3\system and rename these folders

caches to caches.bak

compile-server to compile-server.bak

convert bat

conversion to conversion.bak

external_build_system to external_build_system.bak

frameworks to frameworks.bak

gradle to gradle.bak

resource_folder_cache to resource_folder_cache.bak

Open the Android Studio and open your project again.


Use

File -> Invalidate Caches / Restart...

Then reboot the machine (PC, Laptop etc)


I've encountered the same issue. For some reasons, android Studio replaced all the android:name attributes in most of XML files, including the manifest, to android:subject which isn't recognized by Android Studio.

enter image description here

As you can see in the picture above the IDE doesn't recognize the android:subject attribute. As a result, it won't be able to read the lines which specify the MainActivty.

The solution is simply to change every android:subject to android:name and then Rebuild the project from Build menu -> Rebuild Project. You might encounter the same issue when rebuilding the project, so do the same as above.


100% working

You must be seeing this

enter image description here

First open your manifest and check if this present,

  <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 not present add it

If the above is present but still you see default activity not found.

Follow these steps:

1. Click edit configuration

enter image description here

2. On clicking edit configuration you'll see that launch option is set on DEFAULT ACTIVITY

enter image description here

  1. Change it to nothing.

enter image description here

Problem solved!

Happy Coding.


nothing till here helped me and Android Studio made this problem with all my apps that were running before already - so I knew - it does not has to do with my code.

NOW I SOLVED IT:

You need to reset Android Studio: Just go to C:\Users\yourusername\androidStudio3.2 (or similar) and delete this directory.

This guy shows you exactly how to do it in his video in an older version: https://www.youtube.com/watch?v=AwZEliSPGwU&t


This will help someone who landed on this page like me

I got the error Error: Default Activity Not Found after I copy pasted a code from an online course.

The mistake was in the first line MainActivity.java file

Instead of package com.example.myname.justjava;

the first line was package com.example.android.justjava;

from the code provided for learning

Rectifying it got rid of the error


As this question is a "landing page" for plethora of issues with manifest, resulting in no Default Activity found, here is another thing to check if you are having this problem.

Open your Manifest and switch to Merged Manifest tab.

Sometimes the issue is related to merging all the manifests in the project to one, which can result to error and therefore "Default Activity not found". The problem is this error is not shown anywhere except this Merged Manifest tab as far as I know.

Es: in a project minSdkVersion 10, downgrade the version of implementation in build.gradle file: from 25.4.0 to 25.3.1 solve this problem.

dependencies {
implementation 'com.android.support:appcompat-v7:25.3.1'   
implementation 'com.android.support:design:25.3.1'         
implementation 'com.android.support:mediarouter-v7:25.3.1' 

Merged Manifest


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.


This solution should work for you:

  1. Go to Edit Configuration.

  2. Select Activity select nothing and apply.


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.


Hope this answer helps somebody.

If you already have the <intent-filter> tag, just be sure that you are closing all tags correctly.

My error was that I close the <activity> tag just with a </> instead of </activity>.


I got the same/similar error on different scenario Error: Default Activity Not Found and was not able to run the project. I found out that my project minSdkVersion=16 how ever one of the package require minSdkVersion >= 21. I update the dependencies and build again then I was able to run the project again.

I use Android Studio 4.0.1


In my case File -> Invalidate Caches / Restart... didn't help

Everything was ok with my project and of course I had next intent filter for my activity

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

What really helped me is deleting Android/Gradle cache folders (they can grow up to 10-30 GB)

Go to C:\Users\YOUR_USER_WINDOWS_NAMEand delete next folders

  • .android
  • .AndroidStudio3.2
  • .gradle

(you may save some Android configs from .AndroidStudio3.2 before deleting it if you want it)

You can create bat file CLEAR_CACHE.cmd like this to delete folders without Recycle Bin

rmdir /S /Q .android
rmdir /S /Q .AndroidStudio3.2
rmdir /S /Q .gradle

it would work much faster and you don't have to delete it also from Recycle Bin

p.s. put CLEAR_CACHE.cmd into C:\Users\YOUR_USER_WINDOWS_NAME

it's also a good idea to delete Android Studio folder and download it again


Invalidate Caches / Restart


Just Restart


After that, your app must be run!


You app have launch activity default?

possibly this could be your mistake

enter image description here

Step 1: Select Edit Configurations

enter image description here

Step 2: watch this warning: Default Activity not found enter image description here

Step 3: select a default activity enter image description here

enter image description here

Step 3: Save your changes and finish

enter image description here

Good Luck

enter image description here


Exit Android Studio.

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

Remove /caches folder and /tmp folder


Late in party. Just clean and rebuild. Problem will be gone.


I started with a demo app and modified it. I change the java path inside source from com -> example -> foo to my own and edited the manifest; however, Android Studio (0.8.7) got very confused.

I tried everything listed above and none of it worked for me. Maybe it even made things worse?

My final solution was to edit <projectname>.iml in the .idea subdirectory by opening it up in Android Studio (aka text editor).

Before:

<content url="file://$MODULE_DIR$">
  <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>

I (re)added the src directory (2nd line). After:

<content url="file://$MODULE_DIR$">
  <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>

After saving it, Android Studio reloaded and started functioning as expected.


The correct way to do this is to add the following to the Manifest file:

<activity
    android:name="FULL_NAME_OF_YOUR_ACTIVITY"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

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

This should be inserted between:

<application> </application>

No need in invalidating caches.


TL;DR:

Make sure that you not only check the action and category name, but the path. Especially if you did a refactor.

The solution for me was to closely check the AndroidManifest file. I did a refactor, and it not only updated the intent-filters, but it also updated the path of the intent filter name:

 //type and value were added to the path here when I did the refactor
 <action android:name="android.intent.type.MAIN"/>
 <category android:name="android.intent.value.LAUNCHER"/>

It should be:

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

I changed my Intent-filter to

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Just add DEFAULT option as well. I was using the Process Phoenix library and it prompted me to define a default intent. This addition solved my problem.


Try to right click on the project and choose Open Module Settings. Then go to the Sources tab in your module, find the src folder, right click on it and mark it as Sources (blue color).

EDIT: There is no sources tab in later versions of Android Studio, but you can edit the build.gradle file instead: https://stackoverflow.com/a/22028681/1101730


I was facing similar issue recently. The issue was with activitymanifest XML file. Please check if taglines are closed properly.


In my case this happened because there's was a manifest merger error and I was trying to run the app. Look at the specific error by running Build->Make Project


I was facing the same issue. In my case, I had declared an activity more then one time. After removing duplicate activity the error got resolved.


Check if an activity tag is present inside application tag in AndroidManifest.xml file


If you are working on a widget app this solution should work for you:

  1. Go to Edit Configuration
  2. Set Launch Option to nothing

For me, this problem occurred because of some other reason. So even though it has more than 30 answers, I still feel my solution might help someone.

My styles.xml was looking something like this:

<style name="AppTheme" parent="...">
    ....
</style>

<style name="AppTheme.NoActionBar" parent="...">
    ....
</style>

And my AndroidManifest.xml was something like this:

<application
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
    ....
</application>

And for some reason, I decided to have my theme without ActionBar, so I went ahead and deleted it from my styles.xml. So here is the updated one:

<style name="AppTheme.NoActionBar" parent="...">
    ....
</style>

In addition to this, I had to update the theme in my manifest file, but I forgot that. So when I run the app, I got the error saying:

Error: Default Activity Not Found

After a long struggle, I found the problem and modified my manifest fle accordingly:

<application
    android:label="@string/app_name"
    android:theme="@style/AppTheme.NoActionBar">
    ....
</application>

Conclusion:

If you have a wrong AndroidManifest.xml which may lead into manifest merge failed, then AS can give this error.


In my case I refactored a member variable that was named "activity", I renamed it to "context"... I found out that the refactor was made to the activity tags in manifest, and I found them context tags instead... this is really stupid from Android Studio!


Go to manifest file and then go merge manifest file see error and solve manifest issue

clean project and run


Well I got this error too,

Error: Default Activity Not Found

well in my case it was for wear module ..I don't need an Activity there so what i do is simply

  1. go to edit configuaration ->wear-> Launch Options->Launch->Nothing.
  2. Apply changes.Click Ok.
  3. Remove the existing code for default activity from your manifest file.

Note: Don't forget to Clean Project and Sync Gradle Files.


Edit androidmanifest.xml

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

    <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=".MainActivityName">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

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: enter image description here


@TouchBoarder almost had it. Although selecting "Do not launch Activity" results in nothing launching.

In Android Studio under Run/Debug Configuration -> Android Application -> General -> Activity -> select the option "Launch:"

Choose your Activity. This doesn't exactly fix the intended behaviour but rather overrides it correctly.

Edit run/debug configurations and specify launch activity


The issue in my case was: In my app module manifest, I had to replace other dependency module manifest tag

I added below code under application tag and it worked for me

tools:replace="android:allowBackup, android:usesCleartextTraffic"

For you it might be due to some other properties, you must override them as well


If the options above do not work, try deleting the .gradle folder.

I am using Android Studio 3.3.1. All my projects were fine, when they all suddenly stopped working saying that there was no activity. Even brand new projects were showing the same error. After hours invalidating cache, trying to fix the Manifest file. I've noticed that it had some relationship with androidx libraries like (androidx.core:core-ktx). In some projects, just updating the libs fix the problem, but what actually worked was deleting the .gradle folder.


Go to build.gradle (project: xyz)

buildscript {
    repositories {
        jcenter() 
        google()
    }
allprojects {
    repositories {
        jcenter()
        google()
    }

// Just place 'google()' to the top of 'jcenter()'

buildscript {
    repositories {
        google()
        jcenter()
    }
allprojects {
    repositories {
        google()
        jcenter()
    // enter code here
    }
}

It works perfectly for me.


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 found this blog that really fixed this issue in my case. It turns out you have to add some sort of intent:

<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

It was definitely straightforward. Reference:

https://www.aboutonline.info/2018/08/error-running-app-default-activity-not-found-on-android-with-kotlin.html


While Configuring a new project

the company name should end as .app for example it should be android.example.com.app and it should not be android.example.com


  1. Build -> Rebuild Project
  2. File -> Invalidate Caches.. -> Invalidate and restart

It works for me. Rebuild project to make sure that no errors in project. Then we can invalidate cache.


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.


Sometimes this error because of android studio misbehavior because of internal cache and project building system. Even we have set everything perfect for default activity. For such an issue, I found a solution and It is working for me.

Step 1. Android Studio ---> File--> Invalid Cache and closed android studio.

Step2. Go to path C:\Users\USER.AndroidStudio3.2\system

Step 3. Change name with extension .back of below folder Example: compiler should be compiler.back

  • compiler
  • compiler-server
  • conversion
  • external-build_system
  • framework
  • gradle
  • resource_folder_cache

Step 4: Start Android studio and open your project.

I hope it will work for you.


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

Just add this in your manifest file within tags just replace MainActivity with your default activity and android.intent.action.youractivity will work


This problem is resolved with Android Studio 4.1


I have been having this problem on android studio 3.0.1, and it was caused by manifest merge failure. For some reason I have not been given any error message in the message output. I had to check the merged manifest (app->manifests->AndroidManifest.xml then 'merged manifest' tab) and there at the bottom there was an error indicating that the newest library that was added in the build.gradle had a dependency on some other library whose minSdk was higher than my app minSdk. The solution was in this message and it was to add

<uses-sdk tools:overrideLibrary="timber.log"/>

to AndroidManifest.xml. Actually this library (piwik 1.0.2) had already this overrideLibrary in its manifest.

The strange thing was that other team members didnt experience this problem.


Firstly make sure that you have included default activity in manifest.

Example:

<activity android:name=".DefaultActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

If you have tried everything and nothing seems to works then

  • Delete the cache from your %Home%\.gradle\caches and sync project again.

Or check this answer

https://stackoverflow.com/a/53476487/5507705


Well, I don't understand Android Studio sometimes...

I encountered the same problem and tried the what the answers here told, but to no avail. And then I changed one thing: the action in my intent-filter was having the action name all in caps and I changed it to small and left only the word MAIN in caps, and it solved the problem! How absurd! I hope this can help someone.


my experience: make sure that all your java file has been indentify,if IDEA not indentify your java file ,so he not able to understand what's "Activity" means

good luck :)

enter image description here


This method works for me Click on the app icon and then choose edit configurations. In the edit-configuration choose specified activity instead of the default activity. Then give the path of the activity below.

Click on app and edit configuration

Choose the specified activity and the directory

In the end sync with the gradle files.


In Android Studio 4.0 please change Launch to Nothing:

Run/Debug Configuration -> Android App -> app -> General -> Launch Options -> Launch : Nothing

enter image description here


You Might be missing attributes. Make sure to include this activity inside manifest file


check all the line in your manifest.

in my case i have this error :

android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"

nothing in the logcat


Nothing above helped me. After some time I found that IDEA changed action names to uppercase. Like:

<intent-filter>
  <action android:name="ANDROID.INTENT.ACTION.MAIN"/>
  <category android:name="ANDROID.INTENT.CATEGORY.LAUNCHER"/>
</intent-filter>

After reverting to normal, IDEA recognizes default activity:

<intent-filter>
  <action android:name="android.intent.action.MAIN" />
  <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

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

  1. Remove HomeActivity from librarymodule Manifest whatsoever.
  2. Add:
class AppModuleActivity1 : HomeActivity() to appmodule1
class AppModuleActivity2 : HomeActivity() to appmodule2
  1. To 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>
  1. Same about appmodule2 but change 2 for 1 in naming.

Android Manifest.xml set the starting activity like following

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

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

In Android Studio under Run/Debug Configuration -> Android Application -> General -> Activity -> select the option "Do not launch Activity".


In my case, there was a misstype in AndroidManifest.xml as shown below. Removing "o" letter above application tag solved. Apparently, Android Studio doesn't detect type errors in AndroidMainfest.xml

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

o
<application android:name=".AppName"
             android:allowBackup="false"
             android:icon="@drawable/ic_launcher"
             android:label="@string/app_name"
             android:theme="@android:style/Theme.Light.NoTitleBar">

This occurred to me after my PC restarted unexpectedly.
Strangely, I had made no changes and still got this error.
None of the above helped me. What solved my problem, is this.
Step 1: enter image description here


Step 2: enter image description here


Step 3: enter image description here

If this doesn't solve the problem give other tries.

Try 1:

File -> Invalidate Caches / Restart...

Try 2:
check whether these following two lines

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

are in your launcher activity declaration in manifest.xml

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

Try 3:

  1. Click as shown: enter image description here

  2. Run / Debug Configurations opens. enter image description here





if this also doesn't help.
Try 4:

  1. File->Export to ZIP.
    and
  2. Import it as new project.

Best luck.


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.

Edit:

Additional details (AndroidStudio4.1.2) if the project is created as EmptyApplication then the developer must manually create below 3 files to avoid Default Activity Not Found error

AndroidManifest.xml enter image description here MainActivity.java enter image description here activity_main.xml enter image description here


After updating Android Studio from 1.2.x to 1.3 I got the same problem and I tried all suggestions but nothing worked. Then I did this:

Go to Run/Debug Configurations. Select the configuration that gives the error and delete it. Create a new one with the same name and settings. After that, reconnect the USB cable and run the application.

This solved the problem for me.


Sometimes uninstalling the app for all users helps. Go to Application list in settings go to your app or scroll till the end of the list, then uninstall it. Hope this helps


None of the answers worked for me. The error message said

Unable to read Manifest from ../path/to/the/apk

No default activity found

The error told me that somehow Android Studio is reading previously built apk. Hence, I did ./gradlew clean to get rid of out folder which fixed the problem for me.


It happened to me after upgrading to Android Studio 4.0.

I tried to invalidate caches, to delete and create again the Android App configuration, to select a specific Launch activity but I always got the error stating that the activity wasn't defined on AndroidManifest.xml but of course it was.

What worked for me is going to the Run/Debug configuration (where you define the Launch Options), removing the "Gradle-aware Make" on Before launch at the bottom of the dialog. I run successfully the app and then I added the "Gradle-aware Make" again and everything is working.

Does not make sense, I know. Bus that was what I did.


Go to Manifest -> Merged Manifest Tab (bottom of screen).

On the right panel, if you have any error, resolve it !

This was the solution for me (error with tool:replace not needeed)


You can get Android Studio not to complain by going to the "Edit Configurations" menu (tap "Shift" three times, type "Edit Configurations"), then change Launch Options > Launch to "Nothing".


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>

This is still happening with Android Studio 4.0, so I have to delete the following folder to fix this problem:

C:\Users\my_user_name.AndroidStudio4.0\system\caches


Just sharing how I solved this issue, I had no issue related to intent launcher declaration, I even tried to manually declare the activity still didn't work, also cleared the cache and tmp folder nothing worked. As I had several activities it seems that one of the activities which I pulled from repo had duplicate declarations

enter image description here


Sync Project With Gradle Files works sometimes, To fix this Overall issue you should

  1. Exit Android Studio
  2. Go to USER -> AndroidStudio -> system -> caches
  3. Delete that folder
  4. Start Android Studio.

It will re-index your files and that should work

Thanks to kirtan403 from a similar question.


In case your application doesn't have an Activity (only a service for example), change the run/debug configuration 'Launch' option to Nothing.


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to intellij-idea

IntelliJ: Error:java: error: release version 5 not supported Has been compiled by a more recent version of the Java Runtime (class file version 57.0) Error: Java: invalid target release: 11 - IntelliJ IDEA IntelliJ can't recognize JavaFX 11 with OpenJDK 11 Error: JavaFX runtime components are missing, and are required to run this application with JDK 11 ERROR Source option 1.5 is no longer supported. Use 1.6 or later Cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6 How to configure "Shorten command line" method for whole project in IntelliJ intellij idea - Error: java: invalid source release 1.9 Failed to resolve: com.google.android.gms:play-services in IntelliJ Idea with gradle

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK