Flutter stuck at Installing build\app\outputs\apk\app.apk

126.2k Views Asked by At

When I run:

$ flutter run

I'm getting a prompt on my mobile device asking if I want to install the app on my device. I give yes, then nothing happens!

It's stuck here:

Launching lib/main.dart on POCO F1 in debug mode...
Initializing gradle...                                           1.5s
Resolving dependencies...                                        9.2s
Gradle task 'assembleDebug'...                                  22.9s
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...                     14.9s

Then nothing.

50

There are 50 best solutions below

2
Vishnu On BEST ANSWER

I solved this by manually installing the apk file generated in the builds folder. After that running flutter run runs the app on my phone.

1
Hahnemann On

I hit this problem when I commented all my bitmaps in launch_background.xml:

<!-- You can insert your own image assets here -->
<item>
<!--
    <bitmap
        android:gravity="center"
        android:src="@mipmap/launch_320x480" />
    <bitmap
        android:gravity="center"
        android:src="@mipmap/launch_480x320" />
    <bitmap
        android:gravity="center"
        android:src="@mipmap/launch_480x800" />
    <bitmap
        android:gravity="center"
        android:src="@mipmap/launch_800x480" />
    <bitmap
        android:gravity="center"
        android:src="@mipmap/launch_720x1280" />
    <bitmap
        android:gravity="center"
        android:src="@mipmap/launch_1280x720" />
    <bitmap
        android:gravity="center"
        android:src="@mipmap/launch_1280x1920" />            
    <bitmap
        android:gravity="center"
        android:src="@mipmap/launch_1920x1280" />  
-->          
</item>

I uncommented the bitmaps to get the Flutter build to run. I'm on:

Flutter (Channel beta, v1.0.0, on Mac OS X 10.13.6 17G4015, locale en-US)

3
Stack learner On

For me, the error was due to my work android profile. I uninstalled the debug app in personal profile but it remained in the work profile, once I uninstalled it there and ran flutter run. It worked without any issues. So, First, ensure you deleted the App in both personal and work profile And then run

flutter run

Update:

By profiles I meant, android user profiles on your phone.

0
skyzaDev On

For anybody reading this, I solved this by doing the following:

  1. Open Android Studio->SDK Manager and install API 27 (By default Android Studio only installed the latest (API 28) as at the time of writing and there seem to be issues with using that right now).
  2. In cmd run flutter doctor --android-licenses and make sure you accept all the licenses.
  3. Open Android Studio->AVD Manager and create a new emulator using API 27
  4. Run your app on the new emulator and enjoy!

Hope this helps :).

2
Eric Duffett On

I ran into this issue after changing my package name. Following the instructions on this post helped me: Flutter App is not working after changing package name

0
BVantur On

I had a problem with this when I uninstalled my app from a device, but unfortunately, I didn't uninstall it from all the users that are on my phone. Even Guest kept a version of my app in it, so I solve this issue with uninstalling all version of my app for all users. After that my app was installed without a problem. Sadly we don't get any error message that something is not right if this happens, so I hope this was a case for you guys and that I help you solve it! ;)

3
AgainPsychoX On

I removed debug application from Android menu, and then I ran into the same issue. I restarted my phone, but it wasn't very helpful. My solution was to remove the application completely and reinstall it by hand:

  1. Connect to the device with ADB

  2. Use adb uninstall com.example.application.name

  3. Use adb install C:\PathToYourProject\build\app\outputs\apk\app.apk

By the way, in such uneasy scenarios, flutter run --verbose could provide more detailed information what went wrong.

2
Brian Ogden On

Running flutter clean solved this issue for me using an emulator.

I wiped the emulator data, deleted my emulator, and created a new one, none of that worked. flutter clean worked though.

2
Akram Chauhan On

Try this

  1. First Install App using flutter run from terminal
  2. When App is Installed. long press on app icon and go to app info.
  3. Force stop app.
  4. Remove cache and delete storage which is contained by app.
  5. Uninstall App.
  6. Install Again. it will work.
0
Tørk Egeberg On

When I switched system image for the emulator from Q to Pie it solved it for me.

0
Ganadev Prajapathy On

I got this issue when I uninstalled the flutter app from homescreen. I could not get it installed through android studio or through flutter install commands. What worked for me was to generate the release apk.

flutter build apk

And put the apk in the device and install it again manually through the device. After which there was no issues with installing through both android studio or flutter commands.

0
Naranmandakh Tsogoo On

It is also happenning caused by flutter plugins that doesn't support android api 28.

In my case it caused by this plugin https://pub.dev/packages/connectivity

1
user3852441 On

Installing build\app\outputs\apk\app.apk... is displayed in the Run tab and it doesn't give much information. Please have a look into the Logcat tab and here you can find detailed logs and you may find the reason why you are stuck. If Logcat tab is not visible, please refer this link: Android Studio not showing Logcat with Flutter

0
Tesla Yun On

I also have this problem because I changed a file (my_project\android\app\src\main\java\com\example\my_project\MainActivity.java). and I solved it like this:

package com.example.my_project; //your project name should be changed here.

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity extends FlutterActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
  }
}
1
Sapna Chandel On

You can use:

flutter build apk --release 

flutter install
0
HexaCrop On

If this problem persists in your physical device follow the below operation

Select the app from the apps list in settings (You could see a "not installed for this user" sub along side it)

then Top right menu button "uninstall for all users"

0
Mike On

This happened for me because there was a typo in gradle.properties. I assume it had something to do with the refactor tool in Android Studio. Two settings ended up on the same line like this:

android.enableJetifier = trueandroid.enableR8=true

When I fixed it, it worked again.

0
Aseem On

I closed my emulator and android studio and then restarted it.

0
markhorrocks On

I had this problem after I changed the package name. I fixed it by using this guide

In my case I did not have the java files as described in the article but did need to change the kotlin path similarly to the java path described.

0
Akram Chauhan On

I solved this issue but I would like mention few things. 1. My Fresh Installation was stuck at Installing APK... 2. Same issue on Device as well as in Emulator

I realized that this issue is not device-specific for me. that's why I started looking for solutions.

Solution I tried 1. Flutter Upgrade ( Using Fresh Copy from Flutter.dev) Didn't Solve my Issue 2. Android SDK (Using Fresh Android SDK) Didn't Solve my Issue

Luckily, I found an article that explained you need to keep a few directories out from realtime scanning. I was using FREE-Antivirus

I just tried to Uninstall that and Re-started my machine.

Guess What? Issue Solved :)

3
Vivasvan Patel On

copy the Apk from build\app\outputs\apk\app.apk to your phone.

find the apk on phone and install it manually.

flutter run on will now work as expected.

0
Tommie C. On

Background: While the app was being installed by Android Studio, I manually deleted the app from the device. Thereafter I discovered that the app would not install.

This problem was resolved by going to Settings > Apps and noting that the app was disabled rather than uninstalled even though I did confirm the uninstall request. In any case, I tapped the app and performed an uninstall from the Settings > Apps screen.

0
Arman Khalid On

In my case problem was with installation of apk. Manual installation of apk works in my case

1
Naut BT On

I fixed it:

1. Power off & Close Android Emulator
2. Reopen Android Studio & go to Tools/ AVD Manager
3. In Virtual Devices List, click Dropdown icon > select 'Wipe Data'. Then click 'Launch this AVD...'
4. Waiting for VD open, then click Run in Android Studio

good luck

2
nitin poojary On

Check if you have Guest User in your Device ... Go to that user uninstall the application from guest and then switch to your account and then try running it works.

0
Gökberk Yağcı On

Firstly i removed app with package name on command line. If you do not know package name you can check applicationId in app/build.gradle .

adb uninstall packagename

After then it works.

0
Smeet On

Very easy solution, just uninstall the app using below command even you did not found app on your device or emulator. This is because sometimes even you uninstall app from device from setting, that app still remains there for other users (Multi user feature in devices). So to completely remove the app from device, use below command and then try to install the app again (Restart the android studio to terminate process if it is already running)

adb uninstall <package.name>

e.g.

adb uninstall com.example.myfirstflutterapp
0
Darkonnen On

For me, it was a package: admob_flutter

I'd compiled and updated dependencies but used wrong the package. I realize it by looking at the Log in View -> Tool Windows -> Logcat (ALT+6) in Android Studio.

Before the app running in AVD was crashing, but I didn't know why, not seen an error in the Run Terminal, but the Logcat helped me.

Hope it helps someone.

0
farouk osama On

I happened with me more than once, and every time I restart my mobile and this problem goes away, I used this solution when I tried all the solutions and fails

0
farouk osama On

try this :

  • delete "build" package
  • apply "flutter run" command

enter image description here

0
BHOOPEN SAWANT On

I encountered the same problem when I created my first project. My solution would most probably work on a Xiaomi phone only. You should go to the developer options and then check the option "USB debugging(Security Settings)" under the Debugging menu and then your problem should be resolved.

0
Madhavan On

This problem can be solved by increasing the log buffer size in your Mobile Device or AVD. This option will be available in the Developer Options Menu in the Settings of Your AVD or Mobile Device.

0
wahid anvary On

For me, this error occurs when I add the google firebase in my project, I tried all of the above solutions but not solved the problem, At the end, I could solve this problem by installing the latest version of the Android API virtual device and google play services.

0
saurabh On

Lots of answers here! The one that worked for me -

replace contents of your <app>/android/gradle.properties with the following -

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true

If you don't want to enable R8

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
#android.enableR8=true
0
Basudev Nayak On

On your real Android Device GO to SETTINGS> APPS & NOTIFICATION(you can search it!) > APP INFO > chose the app of the current project > PRESS THE 3 dots > Uninstall for all user.

0
takunda madechangu On

In my case I disabled play protect on simulator and it worked.

1
EKALEB On

If you are running in the emulator, try Wipe Data in AVD Manager

0
Sumanth V S On

Physical Device : I had the same issue when I uninstalled the app from app drawer.

As already answered, one way to fix this is using ADB to cleanly remove it from your phone, but if you don't have ADB installed, try :

  1. Run flutter clean from the project root folder

  2. Switch to the guest profile on your phone (You must have multiple users enabled, if not enable it in Settings by searching for 'users')

  3. Delete the guest profile. (This can be done by swiping down the notification shade when you are in the guest profile --> clicking on the 'guest icon' next to the settings icon --> delete guest

  4. run main.dart

Should be fixed

0
nivalderramas On

Check your AndroidManifest.xml and check that the android:name was properly set with your package name. It worked for me while importing native code.

0
Rahul Badgujar On

This worked for me
Step 1: Run flutter clean (this will delete your build directory)
Step 2: Run/Debug the application on Emulator/Physical Device

0
aashish manandhar On

If you're using MI phone and have turned on second space, i needed to delete the second space (of course i had no data there) to successfully install the apk again. Found this solution here

0
Alex Joseph On

I tried all the solutions above didn't work

I tried running the app from the main.dart file it worked for me

0
Pasindu Jayanath On

On the Android physical device:

  1. Unplug the USB cable.
  2. Uninstall the app (from both personal and work profiles) / uninstall for all users (some devices only have this option).
  3. Cleaned up (using an utility app) (optional).
  4. Searched manually by the app name and delete them on the file explorer.
  5. Restart.
  6. Verify developer options are unable correctly. (After enabling as a developer,) check following developer options are enabled:
    • Developer options.
    • USB debugging.
    • Install via USB.
    • USB debugging(Security settings).
    • Select USB configuration: MTP(Media Transfer Protocol).

On the IDE:

  1. Run flutter clean.
  2. Restart the IDE (optional).
  3. Plug the physical device and check the device is connected as debugging device.
  4. Run flutter pub get and make sure no errors (optional).
  5. Run in debug mode.
0
anmol On

According to me this error is caused by some kind of memory leak or something else.So if you are using a physical device, Restarting the physical device and re-installing the app afterwards worked for me.

0
Sandeep Peddi On

The simplest solution, COLD BOOT !! (must try before any complex processes)

In my case, I noticed the problem is with my emulator. Even without running any project, the emulator was stuck. Hence same error occurred when I tried to run other projects also. In case you are unable to do Cold boot for your AVD, follow below 2 steps and try again

  1. Stop running your project(main.dart) and
  2. delete the lock file at C:\Users\your_name.android\avd\Nexus_6P_API_30.avd\
0
Mubeen On

I use ADB to debug the app and sometimes it gets stuck on installing. I tried reinstalling VS Code and Flutter but found out the issue was with ADB. So, whenever I face this issue I stop the ADB server by:

adb kill-server

and then connect to the device again and the issue is fixed.

0
Pravin Kumar On

Settings>>Accounts and sync>>delete work profile, it will work!!!!

0
Victor Cheng On

I just faced this too and I found that the problem was I accidentally deleted kotlin/MainActivity. So I created a folder with package name, copied the MainActiviy from another project and put in it. This fixed my problem.

0
user17257325 On

Answer enable Developer options?

  1. Enter Settings -> More settings -> About phone (Version);
  2. Click seven times on Software version;
  3. Developer options will appear in Settings -> More settings.
0
Mustafa Ali Dikçinar On

If you have changed the app's package name and if you think you did eveything right. Don't forget to change folder name under

\android\app\src\main\kotlin\com\

and also don't fotget to change package name inside MainActivity.kt