I am using android studio 4.0.1 facing following issue
Tried File -> Invalidate caches / Restart this works once. Works for first run only on restart when I try to run it second time it again shows error default activity not found.
Also tried Edit Configurations... set Specified activity strange issue found it says activity not found in manifest
Here is code from manifest
<activity
android:name=".config.SplashActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Splash">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="domain.com"
android:pathPrefix="/"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- Branch App Links (optional) -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="domain.app.link"
android:scheme="https" />
<data
android:host="domain.app.link"
android:scheme="https" />
</intent-filter>
</activity>
Update: Also tried File -> Sync Project with Gradle files not working.
It is working only once start or restart android studio for second run this issue occurs
Update : Tried updating android studio to new version 4.0.2 still facing the same issue
This is kind of a hack. It worked for me several times.
Step 1- Change the launch option to Nothing.
Step 2- Run the app. It will launch the app but no activity will be displayed.
Step 3- Clean the project, uninstall from the device(optional), and again change the configuration to Default Activity. And invalidate Cache and Restart.
Next a list of different actions you can try. Each entry in the list is a completely different solution independent from each other:
Check your manifest for merge errors. Open your manifest and at the bottom select the Merged Manifest button. Sometimes such problems are caused by merging conflicts:
Ensure your manifest activity has the next intent filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>`
Edit your "Run / Debug Configurations". Change the "Launch" to "Default Activity". If your activity isn't the default one, then change back to "Specified Activity" but select it from the right menu button "the 3 dots button", and do not type manually the activity name.
Edit your "Run / Debug configuration". At the bottom of the "general" tab remove the "Gradle-aware Make" entry. Apply it and exit this window. Build your project, then open again "Run / Debug configuration", and add again the "Gradle-aware Make" entry.
Delete obsolete Android Studio data folders from previous installations. Under your folder "C:\Users\<Your user name>\", remove any older Android Studio folder from previous installations.
"Clean" your project using the option in the "Build" menu, and also use the "Invalidate Caches / Restart" option in Android Studio's File menu.
Do not qualify your activity in the manifest tag, so in your case leave it as:
android:name=".SplashActivity"
Do the opposite of solution 7, so fully qualify it:
android:name="com.my_package.android.config.SplashActivity"
Ensure your activity is defined as public:
public class SplashActivity extends Activity
This may not make any difference, but remove temporarily your activity's theme tag "android:theme="#style/Theme.AppCompat.Splash", just to ensure is not a style related issue which produces an invalid manifest.
Make a backup before proceeding with this solution. Close your project and delete the project's ".gradle" folder. This one will be autogenerated again next time you open it.
Create a new project and import your old project's code into it.
Fully reinstall Android Studio, so uninstall and install.
Try adding <category android:name="android.intent.category.DEFAULT"/> to the first <intent-filter> tag
You should give this a try:
Close Android Studio.
Delete C:\Users\username\.AndroidStudio4.x\system\caches folder.
Try running the build again.
First You need to close your android studio
Then do this
deleting :
1 .android
2 .AndroidStudio
3 .gradle
from C:\Users[your user name]
Start Android studio ( Will take some time to rebuild)
try delete .idea folder or use gradlew build at Terminal
This same issue happened to me couple of days back and was corrected by using the complete name of my activity including my package name in the manifest file (Strange issue). So in your case use
<activity
android:name="com.my_package.android.config.SplashActivity" //<---this line
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="#style/Theme.AppCompat.Splash">
This process worked for me after 2 tries and after that there is no issue till date.
I try to run the app in Android Studio but I get an Error: Default Activity not Found, I have come through all the solutions proposed in this question and none of them worked for me so I Set the launch configuration to a Specified Activity as in the picture:
But when I hit Run I get the error Activity not Found in the manifest file :
here is my full Manifest Declaration:
You only need the Activity name inside package
<activity android:name=".MainActivity >
<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>
</activity>
Try create another activity by android studio and check in the lancher home delete in your manifest this intent filter. Maybe this activity has some corrupted and Android studio dont recognize that
Please remove this line
<category android:name="android.intent.category.DEFAULT"/>
Check if your MainActvity extends AppCompactActivity
Or
May be you are using a wrong package name to register activity.
Check both.
I am currently launching my app from Android Studio deploys, but then attempts to open the activity named EditOrCreateEvent, by showing:
even though the launcher is on the login activity:
<activity
android:name=".app.Session.LoginActivity"
android:configChanges="orientation|keyboardHidden"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Also, the app does not start up automatically, therefore I must navigate and find the app on my phone to open it.
Just a few days ago, upon running from Android Studio, the app would open on phone with no issues, the only change was switching to Gradle 1.5.
How can this be alleviated? Thanks!
Need to change configuration of your app using below step:
1. Goto Edit Configurations... ->
2. Select app option and select General tab. There is Launch option. Then select Default Activity and save your app configuration.
DONE.
I hope its helps you.
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 configuration, but I doubt it. I deleted the configuration folder to verify and that didn't change anything.
If you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after generating a new APK file, you may need to refresh the IDE's cache.
Menu File → Invalidate Caches and restart...
I can't comment on why the upgrade of IntelliJ IDEA 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 file 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.
Additional details
(Android Studio 4.1.2) if the project is created as EmptyApplication then the developer must manually create below three files to avoid the Default Activity Not Found error:
File AndroidManifest.xml
File MainActivity.java
File activity_main.xml
If your app has a launch activity default, possibly this could be your mistake:
Step 1: Select Edit Configurations
Step 2: watch this warning: Default Activity not found
Step 3: select a default activity
Step 3: Save your changes and finish
Good Luck
If you are working on a widget app, this solution should work for you:
Go to Edit Configuration
Set Launch Option to Nothing
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.
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).
There is no sources tab in later versions of Android Studio, but you can edit the build.gradle file instead: How to add a linked source folder in Android Studio?
In Android Studio 4.0, please change Launch to Nothing:
Run/Debug Configuration → Android App → app → General → Launch Options → set Launch to Nothing.
In Android Studio under Run/Debug Configuration -> Android Application -> General -> Activity -> select the option "Do not launch Activity".
Nothing in the previous answers helped me. After some time I found that IntelliJ 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 the default activity:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Firstly make sure that you have the 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:
Android Studio shows wrong file contents
This solution is 100% working
You must be seeing this:
First, open your manifest and check if this is 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:
Click edit configuration
On clicking edit configuration you'll see that the launch option is set on DEFAULT ACTIVITY
Change it to nothing.
Problem solved!
Note
Please make on the root of the manifest file you should have the package name
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.name">
In my case menu File → Invalidate Caches / Restart... didn't help.
Everything was OK with my project and of course I had the following 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 was deleting the Android/Gradle cache folders (they can grow up to 10-30 GB).
Go to C:\Users\YOUR_USER_WINDOWS_NAME and delete the following folders
.android
.AndroidStudio3.2
.gradle
(You may save some Android configurations from .AndroidStudio3.2 before deleting it if you want it.)
This method works for me. Click on the app icon and then choose edit configurations.
In the edit-configuration, choose the specified activity instead of the default activity.
Then give the path of the activity below.
In the end, synchronise with the Gradle files.
Exit Android Studio.
Go to path C:\Users\YOUR_WINDOW_USER_NAME.AndroidStudio3.3\system
Remove the /caches folder and the /tmp folder.
As this question is a "landing page" for plethora of issues with manifests, 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.
For example: 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'
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 the 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.
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, was this.
Step 1:
Step 2:
Step 3:
If this doesn't solve the problem give other tries.
Try 1:
Menu File → Invalidate Caches / Restart...
Try 2:
Check whether the following two lines,
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
are in your launcher activity declaration in file 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:
Click as shown:
Run / Debug Configurations opens.
If this doesn't help either:
Try 4:
Menu File → Export to ZIP.
and
Import it as a new project.
I got this error.
And found that in the manifest file in the launcher activity I did not put action and
category in the intent filter.
The 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>
The 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>
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.
All previous answers didn't help me.
Try to remove
<?xml version="1.0" encoding="utf-8"?>
in your AndroidManifest.
Then menu File → Sync Project with Gradle Files.
In case your application doesn't have an Activity (only a service for example), change the run/debug configuration 'Launch' option to 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.
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 the manifest, and I found them to be context tags instead... this is really stupid from Android Studio side!
Menu Build → Rebuild Project
Menu File → Invalidate Caches... → Invalidate and restart
It works for me.
Rebuild the project to make sure that there aren't any errors in the project. Then we can invalidate the cache.
I have the same problem in Android Studio 3.3 Canary 3.
The project from the Android Studio 3.0 stable version works firstly correctly, but then after some cleans/rebuilds, it starts showing the No Default Activity error.
I tried to reinstall this alpha version of Android Studio: error again. But then I started it in the old stabile Android, and using APK install, and this APK file works correctly.
Moreover, my project was created with Instant App (base, feature, instant, and app subdirectories). I think this Android Studio has some problems with Manifest.xml files separated into this multiple directories.
So I have changed it in settings to this:
Sync Project With Gradle Files works sometimes.
To fix this overall issue you should:
Exit Android Studio
Go to folder USER → AndroidStudio → system → caches
Delete that folder
Start Android Studio.
It will re-index your files and that should work.
Thanks to kirtan403 from a similar question.
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
Remove HomeActivity from librarymodule Manifest whatsoever.
Add:
class AppModuleActivity1 : HomeActivity() to appmodule1
class AppModuleActivity2 : HomeActivity() to appmodule2
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>
Same about appmodule2 but change 2 for 1 in naming.
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
In my case, there was a typo in AndroidManifest.xml as shown below. Removing the "o" letter above the application tag solved it.
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">
Error: Default Activity Not Found
I solved it this way:
Run → Edit Configuration → Android Application → *enter the path of your default activity class in the "Launch" Edit Box.
I have exported my app from eclipse and installed it on my phone. After installation, I click open from package installer, but the installer force close. Afterwards, when I tried to launch the app, nothing happen after I click it. I click the app in app drawer but it return to home screen instead.
I am able to run in emulator and in debug mode when I connect my device via usb, but not when I export the apk to install.
Note that this is not the first app that I exported to install. Previous apps are working fine.
I found the problem! I had declared the activity 2 times in the manifest with different properties, like:
<activity android:name=".myclass"></activity>
and
<activity android:name=".myclass" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Remove the unwanted one from the manifest and it will work.
Check your android emulator version and the firmware version of the phone. If firmware version is not supported for that app you will be install from adb, but you cant start the app.
Check the settings to be able to install the unknown apps in
Settings->Applications and check box "Unknown Sources"
Try to check on permission in Android Manifest. I was having the same problem earlier when i install a NFC app. I forget to give permission for NFC. After i gave the permission it works fine for me. Please check your AndroidManifest.
I spent few days to identify the problem why it occurred .But I solved my problem this way- Modification in Android Manifest
<activity android:configChanges >
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<I removed my code here that i added for reference to google play store for reference >
Remove the unwanted one from the manifest and it will work.
Try to search errors in your Android manifest, i have the same problem and the problem was the 'R' in the category LAUNCHER are in lower case.
like this:
<category android:name="android.intent.category.LAUNCHEr" />
to solve it, simple:
<category android:name="android.intent.category.LAUNCHER" />
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Removing the configuration of all the modules that are not from the app worked for me. In other words, just leave the Project.app module and check its configuration.
Edit Run/Debug Configurations -> Android app -> app
GL
if you use splash in react native:
To avoid error: Binary XML file line #XXX: requires a valid src attribute
inside a layer-list, use:
<item android:drawable="#drawable/image" />
instead of:
<item>
<bitmap android:src="#drawable/image"/>
</item>
My solution is to add this flag in download manager when application is install
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
In my case - i had this flag -> intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
I replaced it with Intent.FLAG_ACTIVITY_NEW_TASK and everything worked!
My Manifest looked like this. Those that need help and have a similar manifest look bellow.
<activity android:name=".login.activities.SplashScreenActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data
android:host="example.com"
android:scheme="https"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You just need to remove the
< data>
element in the intent-filler and it should work.