android - flutter build apk --release 构建 apk 文件但在 Android 上安装后出现错误

标签 android flutter android-studio flutter-android webview-flutter

当我在我的物理设备上运行代码时,我已经使用 webview_flutter: ^1.0.7 包将谷歌网站转换为 android 的 Web 应用程序,通过使其成为外部模拟器,该应用程序可以完美运行,但是当我构建时使用 flutter build apk --release 的 APK 我得到了 APK 文件,当我在打开应用程序后安装 APK 时它说 网页不可用 你可以看到图像以下。我认为它无法通过互联网连接 enter image description here

当我通过让我的设备模拟器安装应用程序时,它可以完美运行,您可以在下面看到

enter image description here

如果您需要有关此的更多信息,请发表评论。

最佳答案

android\app\src\main\AndroidManifest.xml 添加网络权限

例子:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test">

    <uses-permission android:name="android.permission.INTERNET" /> // add this line

   <application
        android:label="test1"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">

访问此页面了解更多信息 INTERNET PERMISSION

关于android - flutter build apk --release 构建 apk 文件但在 Android 上安装后出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72485529/

相关文章:

android - 添加两个库在 Android Studio 中创建错误

android-studio - Android Studio : cursor lost

android - 如何在 Android 客户端上访问特定的 Google Cloud Endpoints API 版本

java - PayPal 支付 Activity 中的空异常

Flutter 可排序拖放 ListView

list - Flutter FireStore空列表

flutter - setState 似乎在构建器函数中不起作用

Android:在 Gradle 构建脚本中使用 packageNameSuffix 时,SearchableInfo 为 null

android - loopj 库在慢速互联网上给出连接拒绝错误

安卓开发 : listview images