flutter默认在安卓下面是没有打开为网络权限的,跟iOS一样,需要配置网络请求的权限。
在项目下面的android/app/src/profile的 AndroidManifest.xml添加如下代码
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.graphqldemo">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
网友评论