skip to Main Content

I’m working on a Flutter project for Android and encountered an error related to the AndroidManifest.xml file. When trying to run my project, I receive the following error message:

package identifier or launch activity not found. Please check /Users/[user]/AndroidStudioProjects/[project]/android/app/src/main/AndroidManifest.xml for errors.
No application found for TargetPlatform.android_arm64.
Is your project missing an android/app/src/main/AndroidManifest.xml? Consider running "flutter create ." to create one.

I’ve checked my AndroidManifest.xml, and it seems correct. The error persists even after ensuring that the package name and target platform are set correctly.

Can someone please provide guidance on how to resolve this issue? What could be causing this error, and what steps should I take to troubleshoot and fix it?

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.webjow.hidden_gallery"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="32"
        tools:ignore="ScopedStorage" />
    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="32" />

    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

    <uses-permission android:name="android.permission.USE_BIOMETRIC" />
    <uses-permission android:name="com.google.android.gms.permission.AD_ID" />

    <application
        android:name="androidx.multidex.MultiDexApplication"
        android:allowBackup="false"
        android:fullBackupContent="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:manageSpaceActivity=".MainActivity"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true"
        tools:replace="android:label"
        tools:targetApi="34">

        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-7518009535578646~8800834968"/>

        <activity
            android:name=".MainActivity"
            android:theme="@style/LaunchTheme" />

        <activity-alias
            android:name="OneLauncherAlias"
            android:enabled="true"
            android:exported="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:targetActivity=".MainActivity"
            android:theme="@style/LaunchTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>

        <activity-alias
            android:name="TwoLauncherAlias"
            android:enabled="false"
            android:exported="true"
            android:icon="@mipmap/calculator"
            android:label="@string/app_name_fake"
            android:targetActivity=".MainActivity"
            android:theme="@style/LaunchTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity-alias>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

Additional Information:

Flutter version: 3.13.5 and Dart version: 3.1.2

2

Answers


  1. Try this.

    1. Remove intent-filter from both activity-alias and add that intent-filter inside the activity.

    2. set android:exported="true" in the activity as well.

      <activity
          android:name=".MainActivity"
          android:theme="@style/LaunchTheme" 
          android:exported="true"
          >
          <intent-filter>
              <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />
          </intent-filter>
      </activity>
      
      <activity-alias
          android:name="OneLauncherAlias"
          android:enabled="true"
          android:exported="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:targetActivity=".MainActivity"
          android:theme="@style/LaunchTheme" />
      
      <activity-alias
          android:name="TwoLauncherAlias"
          android:enabled="false"
          android:exported="true"
          android:icon="@mipmap/calculator"
          android:label="@string/app_name_fake"
          android:targetActivity=".MainActivity"
          android:theme="@style/LaunchTheme" />
      
    Login or Signup to reply.
  2. Duplicate <activity-alias> Elements:
    It seems like you have defined two <activity-alias> elements. This is typically not required. You should only have one <activity-alias> to define the launcher activity.

    Remove either the "OneLauncherAlias" or "TwoLauncherAlias" <activity-alias> based on your requirements. The launcher alias should define the entry point of your app.

    after that it looks like

               <manifest xmlns:android="http://schemas.android.com/apk/res/android"
                package="com.webjow.hidden_gallery"
                xmlns:tools="http://schemas.android.com/tools">
                
                <!-- Your permissions, application, and meta-data here -->
    
                <application
                    android:name="androidx.multidex.MultiDexApplication"
                    android:allowBackup="false"
                    android:fullBackupContent="false"
                    android:icon="@mipmap/ic_launcher"
                    android:label="@string/app_name"
                    android:manageSpaceActivity=".MainActivity"
                    android:requestLegacyExternalStorage="true"
                    android:usesCleartextTraffic="true"
                    tools:replace="android:label"
                    tools:targetApi="34">
                
                    <!-- Your activities and other components here -->
    
                    <meta-data
                        android:name="flutterEmbedding"
                        android:value="2" />
                </application>
            </manifest>
    
    
          
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search