When I am debugging the app, everything works fine, but after I perform these commands:
flutter clean
flutter build apk
flutter install
The installed app is not working properly (Not loading data from API). Any ideas?
pubspec.yaml:
name: test_app
description: A new Flutter project.
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
http: ^0.12.0+2
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
The command flutter run --release compiles to release mode. Your IDE supports this mode. Android Studio, for example, provides a Run > Run… menu option, as well as a triangular green run button icon on the project page.
From the top menus, navigate to Tools -> Flutter and click on Flutter Clean , then try to run again.
Since this is a problem that might concern other developers and the question deserves an answer I've decided to post it as an answer rather than a comment.
When you create a new flutter project, the framework won't add any permissions to AndroidManifest.xml
or any configurations to Info.plist
for iOS. This has to be done manually by the developer.
Also, there are some flutter packages that take care of runtime permissions, but these permissions require user input (grant permission or deny it). Runtime permissions are sensitive permissions but internet access permission is not in this category, so there's no need for requesting user feedback on it.
To be even more confusing, the flutter framework can do API requests in debug mode or on simulators without Internet permission added to the AndroidManifest.xml
(maybe in the future we'll get an error/warning) about missing permission from the flutter team, until then, don't forget to add it in your AndroidManifest.xml
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With