I'm using CachedNetworkImage in my app and it works fine when I run it in debug or release on Android, however when I upload the aab to the Play Store and download the app from the Play Store, the image is just stuck on the placeholder.
Here's how I'm using it in the app. Note that I use a Text widget for the placeholder and the error so that I can visually debug any issues on the release version:
child: Stack(
children: <Widget>[
url != null
? CachedNetworkImage(
imageUrl: url,
errorWidget: (context, url, error) => Text("$error"),
placeholder: (context, url) => Text("Loading $url"),
imageBuilder: (context, imageProvider) => Container(
width: double.infinity,
height: 150,
decoration: BoxDecoration(
image: DecorationImage(image: imageProvider, fit: BoxFit.fitWidth),
),
),
)
: Container(),
It just stays on the placeholder and looks like this
I'm using the latest version of cached_network_image in the pubspec:
cached_network_image: ^2.4.1
Here's what I've tried so far to help narrow down the problem:
- Using
Image.network(url)
instead of CachedNetworkImage. The images load fine when I do this, so I know it's not a problem with the internet or the url. - Running a release build on the device using
flutter run --release
. This works fine, the images load correctly. - Trying out multiple devices. I tried using a Samsung Galaxy 8 on Android 8 and a Pixel 2xl on Android 11. Both work fine with debug builds and release builds, but not when downloaded from the Play Store.
- Making sure the URL is publicly accessible and that internet permissions are enabled. The app is able to load other content from the internet fine and the image url is on a public domain.