50

This's my first flutter App and for some reason the Android launcher icon stopped showing so I was trying to fix that, I did a bunch of things and ended up with this error.

  • flutter doctor shows everything is fine.
  • ios version builds just fine.

p.s I ran flutter create. with no luck.

The IDE log

No application found for TargetPlatform.android_x86.
Is your project missing an android/app/src/main/AndroidManifest.xml?

Consider running "flutter create ." to create one.
Milad Alakaire
  • 619
  • 1
  • 5
  • 6
  • If you have an in your AndroidManifest.xml it's probably this issue: https://github.com/flutter/flutter/issues/80532 – PieterAelse Apr 15 '21 at 20:47

31 Answers31

68

I solved this by flutter clean.

Blasanka
  • 21,001
  • 12
  • 102
  • 104
Gurjap singh
  • 853
  • 8
  • 8
58

Add package back in the manifest file.

Android Studio 'Chipmunk' (2021.2.1) had recommended that I remove package in AndroidManifest.xml:

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

And it added namespace in android/app/build.gradle:

namespace 'com.example'

This didn't immediately break my app, but after cleaning everything, it broke it, and the only fix was to revert, so that the package name remained in the AndroidManifest.xml, as it was before.

The error I was getting was:

package identifier or launch activity not found.
Please check /example/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.
T.Coutlakis
  • 2,436
  • 1
  • 19
  • 19
21

--- Error I got ---

package identifier or launch activity not found.
Please check /example/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.

Step 1: Go to AndroidManifest.xml

Add package="com.example" , repalce with your own package name.

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

Step 2:

flutter clean

Step 3:

flutter pub get

Hope it will solve your issue.

Pankaj Kumar
  • 422
  • 5
  • 10
9

Add or Update

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

package="com.example.name"

8

If flutter clean doesnt work manually delete build folder in project root directory.

Blasanka
  • 21,001
  • 12
  • 102
  • 104
4

The Best Solution ever

  1. open AndroidManifest.xml
  2. add package="com. example"
<manifest xmlns:android="http://schemas.android.com/apk/res/android" `package="com.example">`
  1. change example with your Package name
  2. flutter clean
  3. flutter pub get
mohammed gamal
  • 299
  • 3
  • 4
  • Adding package to the manifest is deprecated in gradle 8. Use the android/namespace parameter in build.gradle instead. – sweetfa Jul 31 '23 at 04:58
3

I created a new project, made sure the new project runs successfully. Then I copied the android folder to the broken project.

Amin
  • 371
  • 2
  • 11
3

For me, on removing the intent filter

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

I got this error, on putting it back the error resolved itself.

3

in the terminal window run "flutter clean" and then "flutter pub get" It will fix it

Renu
  • 63
  • 5
3

What worked for me?

  1. Did a Flutter build to generate Android APK -> It was successfully built
  2. Then tried outrunning the Android app on the Android emulator and the device, it worked as usual.

What didn't work for me?

  1. Restarting the Android Studio
  2. Issuing flutter clean, flutter pub get, flutter packages get
  3. Restarting the computer
  4. Re-cloning the code repository and trying to run the app with a different source code instance
  5. Re-importing the Flutter project to Android studio
  6. Setting up environment variables

So the conclusion:

Most probably due to some busy times I could have closed or stopped an Android build that was ongoing and it has caused a corrupted state in some of the files in the pub cache and which had caused this issue. Got resolved this issue along with some help from my office colleague as well.

Randika Vishman
  • 7,983
  • 3
  • 57
  • 80
3

The issue is "fixed" when some build data is already there, for example when running flutter build apk --debug and then flutter run.

Jimmy
  • 79
  • 1
  • 10
2

I had these same issues, none of the above solutions worked for me. I instead solved it by

  1. Updating my dart SDK check out the instructions here as specified in the dart document

  2. Ran flutter doctor afterwards and it seemed flutter couldn't find the location for my android SDK, (I don't know how) I, therefore, added it with flutter config --android-sdk /Users/<name>/Library/Android/sdk (since i am using a mac).

  3. flutter doctor once more to confirm everything looks ok.

  4. Next I ran flutter clean and flutter pub get.

  5. flutter run and everything looks good.

Dharman
  • 30,962
  • 25
  • 85
  • 135
1

I created a new flutter project and replaced the lib folder, pubspec.yaml and copied the assets folder(if any).It works!

1

So I was editing intent-filter inside manifest.xml and removed few on rewriting below inside intent-filter everything got working

<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Pranay Dutta
  • 2,483
  • 2
  • 30
  • 42
1

I solved by:

  1. Opening the terminal and running this code: flutter clean

  2. flutter pub get

  3. If this doesn't work, use Ctrl+F5 and Wait for the process that run automatically

Henry Ecker
  • 34,399
  • 18
  • 41
  • 57
Alikheiri
  • 43
  • 6
1

An extreme answer for those still facing this problem, delete the android folder and then only run the flutter create . command. Beware if you have any changes made in the android folder though.

1

My manifest was missing package tag:

make sure first two lines are containing package="com.example" first two lines should be in this sequence:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example">
Ali Aslam
  • 71
  • 1
  • 4
0

My short term solution is to reinstall the android studio , there is a closed issue on github https://github.com/flutter/flutter/issues/19869 tackling the exact problem but closed due to insufficient info, consider reopening it.

Mazin Ibrahim
  • 7,433
  • 2
  • 33
  • 40
0

I have the same problem

I tried using the terminal of Android Studio but I could not resolve it. However, when I used

flutter create .

in the terminal of the machine, it worked perfectly solving my problem.

Fabio Veronese
  • 7,726
  • 2
  • 18
  • 27
0
  1. go to your project folder .
  2. type flutter clean
  3. then run your project (it is temporary crush problem) (it occur when your system suddenly shutdown like that)
0

I have solve this problem by Adding in app/main/AndroidMainifest.xml

0

Don't use flutter clean ,

I used flutter clean It doesnt work and casuing so many errors .

then I used flutter create . it is recreating my project and works smoothly.

Rasathurai Karan
  • 673
  • 5
  • 16
0

android build tools was not installed while after installing, it worked.

A.K.J.94
  • 492
  • 6
  • 14
0

This error is due some miss configuration in the AndroidManifest.xml.

In my case The meta-data tag for flutterEmbedding was inside the activity tag, and this was causing the error

If you have another running project, just compare the two files and you should probably find what is wrong.

0

Issue resolved by Updating android SDK from Android Studio -> SDK Took

Also installed latest api's

Yogesh Alai
  • 151
  • 1
  • 5
0

open terminal & write

  • flutter clean
  • flutter pub get

solve this problem

Md Nezam Uddin
  • 262
  • 1
  • 5
0

This Error is because the flutter does not find the SDK path. You just need to set the SDK Path by following the command using the terminal.

flutter config --android-sdk SDK_PATH

For example

flutter config --android-sdk D:\Android\Sdk

0

In my solution after upgrade gradle in AndroidManifest.xml missing

package="com.example. my name here"

Pointer
  • 2,123
  • 3
  • 32
  • 59
-1

Some Cracks in apk in build got me this problem , i deleted apks in build and re run it after cashes clear . worked fine for me.

akhilesh
  • 9
  • 1
  • 7
-2

it always happen to me because my system is overheating and always trips off while compiling my codes. I resolved it by running "flutter clean" and after that i run "flutter run" while connected to the internet.

Emeka Jide
  • 11
  • 2
-3

Deleting AndroidManifest.xml works for me.

sippinman
  • 51
  • 1
  • 9