Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter Image.network not working on release apk

Tags:

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.

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.

I have tried with flutter clean and then flutter build apk --release but same issue coming

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). 

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. 

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?

What I have to add some permission for release mode apk?

like image 278
Govaadiyo Avatar asked Mar 02 '19 06:03

Govaadiyo


People also ask

How do I show my network image in flutter?

Flutter has an Image widget to display different types of images. To display images from the internet, the Image.network() function is used. Properties Of Image Widget: height: This property takes in an integer value as the object.

What is app APK in flutter?

This tutorial shows you how to build APK files for Android for applications developed using Flutter. APK (Application Package File) is a format used by Android operating systems for distribution and installation. After you build an application, it's quite common to build APK files to be tested across different devices.


1 Answers

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" /> 

Updated: only INTERNET permission is enough

<uses-permission android:name="android.permission.INTERNET" /> 
like image 101
Long Phan Avatar answered Sep 21 '22 18:09

Long Phan