Flutter: flutter run stuck at “Installing build/app/outputs/flutter-apk/app-debug.apk”
If you’re a Flutter developer, you might have encountered a frustrating issue where running your app with flutter run gets stuck at the message “Installing build/app/outputs/flutter-apk/app-debug.apk”. This problem can be caused by various factors, but fear not – there are several solutions you can try to resolve it. In this blog post, we’ll walk you through the steps to fix this issue and get your Flutter app up and running smoothly.
Solution 1: Verify Package Name Changes
If you recently changed the package name of your app, this can cause conflicts during installation. Here’s what you can do:
- Check Manifest Files: Ensure that the new package name is correctly reflected in both the
AndroidManifest.xmlfile located inandroid/app/src/mainand theInfo.plistfile inios/Runner. - Update Build Gradle Files: Navigate to
android/app/build.gradleand ensure that theapplicationIdmatches the new package name. - Update MainActivity File: Navigate to
android/app/src/your/package/name/MainActivity.ktand modifyyour/package/namecorrectly. Make that change toMainActivity.ktfile as well. - Rebuild and Reinstall: After making these changes, try running
flutter runagain.
Solution 2: Validate google-services.json
The google-services.json file is crucial for Firebase integration. If it’s not configured correctly, it can cause installation hang-ups. Here’s how to address this:
- Download Correct
google-services.json: Make sure you have the correctgoogle-services.jsonfile for your project, and it’s placed in theandroid/appdirectory. - Verify Firebase Configuration: Ensure that your Firebase project is correctly set up and associated with the Android app.
- Rebuild and Reinstall: After confirming the correct
google-services.json, attempt to run the app again.
Solution 3: Clear Residual App Data
If there’s an existing app on the device with the same package name, it might interfere with the installation process. Here’s how to handle it:
- Manually Uninstall App: Go to the device’s settings, find the app with the conflicting package name, and uninstall it.
- Restart Device: After uninstalling the app, restart the device to clear any residual data.
- Rebuild and Reinstall: Once the device is restarted, try running the app again using
flutter run.
Conclusion
Being stuck at “Installing build/app/outputs/flutter-apk/app-debug.apk” can be a frustrating hiccup in your Flutter development process. By addressing package name changes, ensuring the correct google-services.json file, and clearing out any remnants of existing apps, you should be able to overcome this obstacle.
Remember, patience and persistence are key when troubleshooting. If one solution doesn’t work, move on to the next. With these steps, you’ll be back on track in no time, building amazing Flutter applications.
HAPPY CODING !