Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 463
MrLalatg Avatar asked May 08 '19 17:05

MrLalatg


People also ask

How do you run the flutter app in release?

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.

Why my flutter app is not opening?

From the top menus, navigate to Tools -> Flutter and click on Flutter Clean , then try to run again.


1 Answers

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.

like image 108
danypata Avatar answered Sep 22 '22 10:09

danypata