3

Whenever trying to run the app, getting the error:

"Could not identify launch activity: Default Activity not found".

I have seen a few other threads on the same issue, but the below solutions have not worked for me:

  1. Invalidating gradle cache and re-running
  2. Manually overriding in the edit configuration tab to select the default activity (it then says "The activity 'MainActivity' is not declared in AndroidManifest.xml" even though it is!)
  3. Re-syncing the gradle files
  4. Literally shuffling around the order of the activities in my manifest
  5. Using the long name for my activities, but doesn't make any difference
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.mywebname">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_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">

        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".ListenScreen"
            android:parentActivityName=".MainActivity"
            android:screenOrientation="portrait">
        </activity>

 </application>

</manifest>
```

As you can see, I have clearly declared the activities (my app only has 2 so far), and I've put the intents around the ".MainActivity".
Greg M
  • 31
  • 1
  • 3

2 Answers2

13

This answer worked for me after trying so many other tweaks, just adding the package name solved my problems

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.name">

https://stackoverflow.com/a/72300233/8720836

Crucialjun
  • 193
  • 1
  • 8
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31956474) – Semih Arslanoglu Jun 11 '22 at 11:26
  • Worked in my case I had a newly initialised flutter project app. – ritik kumar srivastava Nov 08 '22 at 19:16
1

You can only have to add the package name inside the manifest tag you can find your package name inside app.gradle file and you are good to go