Milan singh Chouhan
Milan singh Chouhan

Reputation: 11

FLUTTER app unable to display network images in release mode

I have build a whatsapp clone ui it displays images well in debug mode but when i built apk it do not show any image please help anyone

My Apps Menifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.milan.whatsapp.whatsapp_clone">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

buildGradle file

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 32
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.milan.whatsapp.whatsapp_clone"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion 23
        targetSdkVersion 32
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

code of activity--

 leading: CircleAvatar(
          backgroundImage: NetworkImage(
          info[index]['profilePic'].toString(),
            ),
          ),

here info has the Jsonfile where all the data is present like the image links

output in Debug Mode is Shown below

Screen in debugmode

output after building the release apk

Screen in release mode without images

I just added permissons in the andorid manifest file which is uploaded above

Upvotes: 0

Views: 147

Answers (0)

Related Questions