Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.43k stars 654 forks source link

Image Does not load in release mode #580

Closed athul-ain closed 3 years ago

athul-ain commented 3 years ago

🐛 Bug Report

The app works fine on debug mode and everything works, when I run a release mode APK then the image won't load. Already have the internet permission on Android Manifest, also other network calls are working (Firebase).

Is there any extra configuration needed to fix this issue?

I have already use cached_network_image in my multiple projects, and it was working well. Is this the bug on the null safety version of the plugin?

Expected behavior

Reproduction steps

Configuration

Version: 3.0.0

Platform:

renefloor commented 3 years ago

When I build an apk from the example it does show the images. Maybe something is wrong with proguard? Can you log the error (from inside the errorWidgetBuilder)?

athul-ain commented 3 years ago

When I build an apk from the example it does show the images. Maybe something is wrong with proguard? Can you log the error (from inside the errorWidgetBuilder)?

Screenshot_20210329-124306_NEXUS.png

It doesn't show an error message it just shows the placeholder

The below is my code of the widget

Card( clipBehavior: Clip.antiAlias, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(13)), child: Container( width: isCarousel ? double.infinity : 350, child: CachedNetworkImage( fit: BoxFit.fill, imageUrl: bannerData.image!, imageBuilder: (context, imageProvider) => Material( child: Ink.image( image: imageProvider, fit: BoxFit.cover, child: InkWell( onTap: bannerData.link == null ? null : () { gotoLinkPage( link: bannerData.link!, context: context); }), ), ), placeholder: (context, url) => Center( child: CircularProgressIndicator.adaptive(), ), errorWidget: (context, url, error) => Center( child: Text(error.toString()), ), ), ), )

Ali-Elganzory commented 3 years ago

Encountered same issue. This workaround worked for me.

patelharsh15 commented 3 years ago

I am also facing the same issue, but the only difference is that I am using cached_network_image: ^2.0.0. I think that it is bug.

patelharsh15 commented 3 years ago

Encountered same issue. This workaround worked for me.

Yes it also work for me. But I don't understand why it worked. Anyway thanks for your answer

renefloor commented 3 years ago

I think some class is removed by minifying, maybe something from sqflite, that shouldn't be removed. Strange thing though is that I use cachednetworkimage in a production app with minify enabled that just works.

RafaelR7 commented 3 years ago

I'm having the same issue, but only when running in debug mode

renefloor commented 3 years ago

I'm having the same issue, but only when running in debug mode

Doesn't really sound like the same issue. As far as I know you shouldn't enable minify on debug mode.

Your images don't show in debug mode, but do show in production?

ServOKio commented 3 years ago

I have the same problem. In debug mode, the images are not loaded, but there is no error

1

  1. And yes, the image loads normally in the release

  2. I fixed the loading in gradle:

    android {
    ...
    buildTypes {
        debug {
            shrinkResources false
            minifyEnabled false
        }
        ...
    }
RafaelR7 commented 3 years ago

Your images don't show in debug mode, but do show in production?

Yes, same problems as @ServOKio, some of my images won't load when running in debug mode, on release the images are working fine I just tested on IOS in debug mode and is working aswell.

renefloor commented 3 years ago

Can you create a new ticket for that and describe how to reproduce? This ticket is about not showing in release mode (probably because of minify).

RafaelR7 commented 3 years ago

Can you create a new ticket for that and describe how to reproduce? This ticket is about not showing in release mode (probably because of minify).

Ok, I'll do that 👍🏻

no-response[bot] commented 3 years ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

bhavik-multipl commented 3 years ago

Faced same issue, image is not loading, neither in release and debug mode.

I have tried this workaround but no luck.

P.S. This does not happen everytime, it is happening at specific place but other places it works without any issues.

CachedNetworkImage(
  imageUrl: "https://avatars.githubusercontent.com/u/68329541?s=400&v=4",
  fit: fit,
  height: height,
  width: width,
  color: color,
  imageBuilder: (context, imageProvider) {
    return Material(
      clipBehavior: Clip.antiAlias,
      color: Colors.transparent,
      child: Ink.image(
        image: imageProvider,
        fit: fit,
        height: height,
        width: width,
      ),
    );
  },
),
kightsonsanom commented 2 years ago

This is still an issue, disabling obfuscation on android release build is not a valid solution. Please reopen this issue.

leeprobert commented 2 years ago

I am seeing this bug too. Only on Release build.

TENX-S commented 2 years ago

Still an issue on physical devices with a release build (iPhone Xs Max) iOS 15.4.1, Flutter 2.10.3 • channel stable. Works fine on Android emulator.

manthri-mohan-sai commented 8 months ago

Still facing this issue with release build.

misteloo commented 8 months ago

I faced with this bug in release mode :'(

misteloo commented 8 months ago

I faced with this bug in release mode :'(

FIX already I used container width through getx Container(width : Get.width /2 ) now i changed this to MediaQuery.of(context).size.width

AwaisQazii commented 5 months ago

@misteloo it worked. Thanks

nadeemamanah commented 2 months ago

@misteloo Been stuck on this for hours, This fixed it. Thanks