简体   繁体   English

flutter 构建 apk 文件不适用于 http 请求?

[英]flutter build apk file not working on http requests?

I used the command flutter build apk --split-per-abi then the app size got reduced from 48Mb to 7.1Mb.我使用命令flutter build apk --split-per-abi然后应用程序大小从 48Mb 减少到 7.1Mb。 But in this reduced apk, the HTTP requests are not working.但是在这个简化的 apk 中,HTTP 请求不起作用。 I also built using flutter build apk , through this the app size reduced to 19Mb, In this also the requests are not working.我还使用flutter build apk ,通过此应用程序大小减少到 19Mb,在此请求也不起作用。 So what to do to reduce the application size and make the app work perfectly.那么如何减少应用程序大小并使应用程序完美运行。

As Testeur Maniak said to add the internet permission tag in the manifest.xml file, in the above comments.正如Testeur Maniak所说,在上面的评论中,在 manifest.xml 文件中添加互联网权限标签。 I tried by adding the line我尝试添加该行

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

Now it is working perfectly.现在它运行良好。

If doing the above but still not working.如果执行上述操作但仍然无法正常工作。 Try changing your endpoints url from "HTTP" to "HTTPS".尝试将您的端点 url 从“HTTP”更改为“HTTPS”。 example;例子;

If it was " http://mylink.com/api" Change it to "https://mylink.com/api"如果是“ http://mylink.com/api”将其更改为“https://mylink.com/api”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM