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
Try this.
Remove
intent-filter
from bothactivity-alias
and add thatintent-filter
inside theactivity
.set
android:exported="true"
in the activity as well.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