androidflutterkotlinicons

Flutter showing blank cross (X) icons


I got a native android app (maintained by a team). I have added the flutter app to this existing android app. This flutter app is basically a flutter module rather than a flutter project. All I need is to open the flutter module with this existing android native app. But along with this, I also wanted to

  1. Making use of a few already built and tested android libraries(SDK)
  2. Not forcing the native team to install flutter SDK.

For these reasons what I did was I made a native bridge that implements method channels for my purposes such as for networking, analytics, etc so that it doesn’t break any mini-app rules like initializing its own network or analytics, etc. This native android bridge is responsible for making network calls and making communication between the android app and the flutter app. The problem starts when it opens the flutter app, the icons are not being rendered correctly. Rather it shows black cross icons throughout the flutter part.enter image description here

So summarizing my scenario I have used option A in the link https://flutter.dev/docs/development/add-to-app/android/project-setup to add the flutter module to an android project and this android project serves as a bridge for communicating with the main android app maintained by a team.

Here is the image for flutter doctor which shows currently I am using flutter 2.0 (2.0.2)

Flutter Doctor for version

Below is the stack trace generate

stack trace

Below is the image to illustrate where I put all my icons (directory structure):

Directory structure

Below is the image for pubspec.yaml

pubspec.yaml

Below is the image for the code. I am calling my own custom widget with only the image name as a parameter. The complete path to assets/icons is being handled by the CustomListTileWidget itself:

adding image from assets in code

Calling my Custom Widget

Furthermore, the problem is not only with asset images. But it does not even render Icon with IconData. Currently, no icon is being displayed by flutter

enter image description here


Solution

  • Fixed the above problem. The problem was with the flutter module build. When I rebuild the module by "flutter build aar", that solved the issue.