安装后,Flutter发行的应用程序无法在设备上运行 [英] 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
已安装的应用程序无法正常运行(未从API加载数据).有什么想法吗?
The installed app is not working properly (Not loading data from API). Any ideas?
pubspec.yaml:
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
推荐答案
由于这是一个可能会引起其他开发人员关注的问题,因此该问题值得一个答案,因此我决定将其发布为答案而不是评论.
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.
在创建新的flutter项目时,该框架不会为iOS的AndroidManifest.xml
添加任何权限,也不会为Info.plist
添加任何配置.这必须由开发人员手动完成.
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.
此外,还有一些Flutter软件包可用于处理运行时权限,但是这些权限需要用户输入(授予或拒绝).运行时权限是敏感权限,但是Internet访问权限不在此类别中,因此无需请求用户对此提供反馈.
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.
更令人困惑的是,flutter框架可以在调试模式下或在模拟器上执行API请求,而无需将Internet许可添加到AndroidManifest.xml
(可能在将来,我们会收到错误/警告),提示您缺少来自直到那时,别忘了将它添加到您的AndroidManifest.xml
文件中.
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.
这篇关于安装后,Flutter发行的应用程序无法在设备上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!