Search code examples
dartflutterpermissionsreleaseflutter-dependencies

Flutter released app not working on the device, when installed


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?

Screenshot of app

Screen of app

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


Solution

  • 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.