Layout, Icons, Asset/Network Images are not working on Flutter Release APK

700 views Asked by At

this is the first time I have encountered this problem, where App Layout, Icons, Asset/Network Images are not working on Flutter Release Build.

I already tried cleaning, building multiple times but no luck.

android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.app">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
   <application

pubspec.yaml

name: app
description: A new Flutter project.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
  sdk: ">=2.16.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  
  bottom_picker: ^1.7.0
  uuid: ^3.0.6
  flutter_phone_direct_caller: ^2.1.0
  vertical_tab_bar_view: ^0.0.1
  extended_masked_text: ^2.3.1
  intl: ^0.17.0
  carousel_slider: ^4.0.0
  jiffy: ^5.0.0
  dotted_border: ^2.0.0+2
  image_picker: ^0.8.4
  
  flutter_statusbarcolor_ns: ^0.4.0
  
  rflutter_alert: ^2.0.4
  titled_navigation_bar: ^5.0.0-nullsafety.0
  flutter_vector_icons: ^1.0.0
  loading_indicator: ^3.0.2
  
  http_parser: ^4.0.0
  
  dio: ^4.0.4  
  get: ^4.6.1

  google_sign_in: ^5.2.4
  google_fonts: ^2.3.1  

  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^1.0.0

DEBUG AND RELEASE MODE MODE enter image description here

enter image description here

1

There are 1 answers

2
Francesco Bocci On

Follow this tutorial: https://docs.flutter.dev/development/ui/assets-and-images

In your pubspec.yaml add:

assets:
    - assets/yourimage.png

Then, you can call your img like:

return const Image(image: AssetImage('assets/yourimage.png'));