3

I have made a list of images and using ListView.builder to display the images and its working perfectly fine while debugging and even in debug apk of the app but when i use release apk its not showing the images.

List<Activity> act = [
    Activity('assets/sports.png', 'Sports', false),
    Activity('assets/sleeping.png', 'Sleep', false),
    Activity('assets/shop.png', 'Shop', false),
    Activity('assets/relax.png', 'Relax', false),]

I am using ListView.builder to show images like this:

ListView.builder(
              scrollDirection: Axis.horizontal,
              itemCount: act.length,
              itemBuilder: (context, index) {
                return Row(children: <Widget>[
                  SizedBox(
                    width: 15,
                  ),
                  GestureDetector(
                      child: ActivityIcon(act[index].image)));
dev-aentgs
  • 1,218
  • 2
  • 9
  • 17
  • 2
    This could be a race issue where the list is not populated before the ListView is built. Flutter release versions run considerably faster than debug version. Difficult to tell, though, without seeing more relevant code eg. where you set up the list. – GrahamD Jul 28 '20 at 16:03
  • 1
    https://github.com/Himanshuranjan30/mood : Can you check my project here? the code is in start.dart file in screens. Thanks –  Jul 28 '20 at 16:06
  • 1
    Can't see anything obviously wrong with your code. Maybe use adb logcat to see if anything weird is showing up. – GrahamD Jul 28 '20 at 16:43
  • 1
    I posted this SO link on Discord as a possible way to find the issue https://stackoverflow.com/questions/61615866/flutter-app-show-grey-screen-in-release-mode-but-works-fine-in-debug-mode-instan – GrahamD Jul 28 '20 at 17:19

2 Answers2

1

Make sure that you've "use-material-design: true" line above assets

enter image description here

Sambhav jain
  • 1,467
  • 12
  • 19
Sahil R
  • 11
  • 4
0

There doesn't seem to be an issue from the code you've provided. It'll greatly help if you're able to provide any errors received from the app when the issue occurred. Another way that you can try is by switching to different Flutter channels and see if the app performs better.

Omatt
  • 8,564
  • 2
  • 42
  • 144