抖动Image.network无法在版本apk上运行 [英] flutter Image.network not working on release apk
问题描述
遇到奇怪的问题.如果我在模拟器中运行应用程序,则可以正常运行.如果我通过连接android设备安装了应用,效果很好.但是,如果我通过flutter build apk
创建apk并安装在设备中.
Getting weird issue. If I run app in simulator, works fine. If I installed app by connecting android device works fine. But if I made apk by flutter build apk
and installed in device.
网络图像不出现?为什么?有什么问题吗?无需提供代码.对于展示广告网络图片,我将简单的Image.network
与来自Google图片的网址一起使用.
Network image not coming? Why? any thing is going wrong? No need to provide code. For display network image, I'm using simple Image.network
with url from google image.
我尝试过使用flutter clean
,然后尝试使用flutter build apk --release
,但同样出现了问题
I have tried with flutter clean
and then flutter build apk --release
but same issue coming
不通过发布APK工作:
NOT WORKING BY RELEASE APK:
Uer-MacBook-Air:AppName user$ flutter build apk --release
Initializing gradle... 2.0s
Resolving dependencies... 3.1s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 63.4s
Built build/app/outputs/apk/release/app-release.apk (8.1MB).
使用调试APK
WORKING BY DEBUG APK
Uer-MacBook-Air:AppName user$ flutter build apk --debug
Initializing gradle... 3.5s
Resolving dependencies... 5.5s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 36.2s
Built build/app/outputs/apk/debug/app-debug.apk.
有人遇到过这类问题吗?我已经通过flutter build apk
安装了许多apk,并且工作正常,现在无法在发布模式下工作?但是,当我尝试使用调试模式flutter build apk --debug
时,它的工作正常意味着图像正在显示吗?
Anybody has faced this type of issue? I have installed many apk by flutter build apk
and that was work fine and right now not working in release mode? But when I tried with debug mode flutter build apk --debug
its working fine means images are displaying?
我需要为发布模式apk添加一些权限吗?
What I have to add some permission for release mode apk?
推荐答案
是的,将这些权限添加到AndroidManifest.xml即可使用
Yes, add these permissions to AndroidManifest.xml and it will work
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
已更新:仅INTERNET权限已足够
Updated: only INTERNET permission is enough
<uses-permission android:name="android.permission.INTERNET" />
这篇关于抖动Image.network无法在版本apk上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!