How to fix "Default Activity not found" when I have set the activity in android manifest file?

2.1k Views Asked by At

First of all, I have read similar questions to mine and have tried out all the solutions recommended. These solutions includes:

  1. Invalidate cache and restart
  2. Sync with gradle
  3. Restarting Android Studio
  4. Clean and Build
  5. Change the configurations to "Nothing" on the Launcher section
  6. Changing the android:name on manifest file to a full package name (E.g:com.example.acer.alertbox.ActivityName)

None of these solutions seems to be working, and i keep getting the error mesage saying that "Default activity not found". I have been trying to figure this out for a week already so I hope someone will give me a new solution apart from those 6 that I have mentioned above. Below is my android manifest code which seems fine to me and that which i have checked multiple times.

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

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>

    <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"
            tools:ignore="GoogleAppIndexingWarning">

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

        <activity
                android:name=".LoginActivity"
                android:parentActivityName=".MainActivity">
        </activity>
        <activity
                android:name=".RegisterActivity"
                android:parentActivityName=".MainActivity">
        </activity>
        <activity
                android:name=".SendActivity"
                android:parentActivityName=".MainActivity">
        </activity>
        <activity
                android:name=".Profile"
                android:parentActivityName=".MainActivity">
        </activity>
        <activity android:name=".NotificationActivity">
                  <intent-filter>
                      <action android:name="com.example.acer.alertbox.TARGETNOTIFICATION">
                      </action>
                  </intent-filter>
        </activity>

        <service
            android:name=".FirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT">
                </action>
            </intent-filter>
        </service>

        <meta-data
                android:name="com.google.firebase.messaging.default_notification_channel_id"
                android:value="@string/default_notification_channel_id" />


    </application>

</manifest>

Updated: I have uninstalled and reinstalled Android Studio, the problem is solved but another one came. The "Run" button is not doing anything when i clicked on it and i got a warning at the bottom right corner saying internal IDE error: unable to locate adb. I have downloaded the adb file and locate it on this directory C:/Acer/Users/Local/Sdk but still it doesnt change anything. I have also restart, sync the project gradle file etc. but nothing works!! Please someone help me. Below is what i got from the internal error report:

Unable to locate adb
java.lang.IllegalArgumentException: Unable to locate adb
    at com.android.tools.idea.run.editor.DeployTargetPickerDialog.<init>(DeployTargetPickerDialog.java:131)
    at com.android.tools.idea.run.editor.ShowChooserTargetProvider.showPrompt(ShowChooserTargetProvider.java:113)
    at com.android.tools.idea.run.AndroidRunConfigurationBase.getDeployTarget(AndroidRunConfigurationBase.java:605)
    at com.android.tools.idea.run.AndroidRunConfigurationBase.getState(AndroidRunConfigurationBase.java:287)
    at com.intellij.execution.runners.ExecutionEnvironment.getState(ExecutionEnvironment.java:158)
    at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:55)
    at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:50)
    at com.intellij.execution.ProgramRunnerUtil.executeConfigurationAsync(ProgramRunnerUtil.java:97)
    at com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:44)
    at com.intellij.execution.impl.ExecutionManagerImpl.start(ExecutionManagerImpl.java:111)
    at com.intellij.execution.impl.ExecutionManagerImpl.access$300(ExecutionManagerImpl.java:59)
    at com.intellij.execution.impl.ExecutionManagerImpl$3.run(ExecutionManagerImpl.java:439)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:231)
    at com.intellij.util.Alarm$Request.runSafely(Alarm.java:405)
    at com.intellij.util.Alarm$Request.access$700(Alarm.java:330)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:371)
    at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:447)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:431)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:415)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:822)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:763)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Latest update: Problem solved by restoring adb.exe from Avast antivirus.

1

There are 1 best solutions below

6
Shoaib Akram On

Here are some of possible reasons you can check

  1. Is there any activity or activities that are deleted but still present in manifest
  2. Add this tag in intent filter and check if it works

    <category android:name="android.intent.category.DEFAULT"/>

  3. Check the configuration tab if it is configured correctly for more details follow the link Error: Default Activity Not Found