Flutter stuck at Installing build\app\outputs\apk\app.apk
FlutterDartApkFlutter ReleaseFlutter AndroidFlutter Problem Overview
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.
Flutter Solutions
Solution 1 - Flutter
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.
Solution 2 - Flutter
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:
-
Connect to the device with ADB
-
Use
adb uninstall com.example.application.name
-
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.
Solution 3 - Flutter
I ran into this issue after changing my package name. Following the instructions on this post helped me: https://stackoverflow.com/questions/52283117/flutter-app-is-not-working-after-changing-package-name
Solution 4 - Flutter
Try this
- First Install App using flutter run from terminal
- When App is Installed. long press on app icon and go to app info.
- Force stop app.
- Remove cache and delete storage which is contained by app.
- Uninstall App.
- Install Again. it will work.
Solution 5 - Flutter
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"
Solution 6 - Flutter
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.
Solution 7 - Flutter
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.
Solution 8 - Flutter
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.
Solution 9 - Flutter
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! ;)
Solution 10 - Flutter
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)
Solution 11 - Flutter
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: https://stackoverflow.com/questions/51007784/android-studio-not-showing-logcat-with-flutter
Solution 12 - Flutter
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.
Solution 13 - Flutter
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
Solution 14 - Flutter
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.
Solution 15 - Flutter
For anybody reading this, I solved this by doing the following:
- 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).
- In cmd run
flutter doctor --android-licenses
and make sure you accept all the licenses. - Open Android Studio->AVD Manager and create a new emulator using API 27
- Run your app on the new emulator and enjoy!
Hope this helps :).
Solution 16 - Flutter
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);
}
}
Solution 17 - Flutter
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
Solution 18 - Flutter
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.
Solution 19 - Flutter
-
open cmd in windows
-
goto this location in cmd
C:\Users\[user]\AppData\Local\Android\sdk\platform-tools
-
type this command :-
adb uninstall com.example.application.name(Package name)
-
if u see command success
-
then run flutter project again.
Solution 20 - Flutter
When I switched system image for the emulator from Q to Pie it solved it for me.
Solution 21 - Flutter
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.
Solution 22 - Flutter
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.
Solution 23 - Flutter
In my case problem was with installation of apk. Manual installation of apk works in my case
Solution 24 - Flutter
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.
Solution 25 - Flutter
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.
Solution 26 - Flutter
Solution 27 - Flutter
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.
Solution 28 - Flutter
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 :
-
Run flutter clean from the project root folder
-
Switch to the guest profile on your phone (You must have multiple users enabled, if not enable it in Settings by searching for 'users')
-
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
-
run main.dart
Should be fixed
Solution 29 - Flutter
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.
Solution 30 - Flutter
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.
Solution 31 - Flutter
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
Solution 32 - Flutter
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
Solution 33 - Flutter
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.
Solution 34 - Flutter
I closed my emulator and android studio and then restarted it.
Solution 35 - Flutter
I solved this issue but I would like mention few things.
- My Fresh Installation was stuck at Installing APK...
- 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
- Flutter Upgrade ( Using Fresh Copy from Flutter.dev) Didn't Solve my Issue
- 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 :)
Solution 36 - Flutter
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.
Solution 37 - Flutter
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
Solution 38 - Flutter
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.
Solution 39 - Flutter
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.
Solution 40 - Flutter
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
Solution 41 - Flutter
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
Solution 42 - Flutter
On the Android physical device:
- Unplug the USB cable.
- Uninstall the app (from both personal and work profiles) / uninstall for all users (some devices only have this option).
- Cleaned up (using an utility app) (optional).
- Searched manually by the app name and delete them on the file explorer.
- Restart.
- 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:
- Run
flutter clean
. - Restart the IDE (optional).
- Plug the physical device and check the device is connected as debugging device.
- Run
flutter pub get
and make sure no errors (optional). - Run in debug mode.
Solution 43 - Flutter
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
- Stop running your project(main.dart) and
- delete the lock file at C:\Users\your_name.android\avd\Nexus_6P_API_30.avd\
Solution 44 - Flutter
Settings>>Accounts and sync>>delete work profile, it will work!!!!
Solution 45 - Flutter
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.
Solution 46 - Flutter
Answer enable Developer options?
- Enter Settings -> More settings -> About phone (Version);
- Click seven times on Software version;
- Developer options will appear in Settings -> More settings.
Solution 47 - Flutter
In my case I disabled play protect on simulator and it worked.
Solution 48 - Flutter
If you are running in the emulator, try Wipe Data in AVD Manager
Solution 49 - Flutter
I tried all the solutions above didn't work
I tried running the app from the main.dart file it worked for me
Solution 50 - Flutter
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
Solution 51 - Flutter
You can use:
flutter build apk --release
flutter install