flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

Exception: Invalid image data

Open bxxasn opened this issue 2 years ago • 18 comments

Flutter is used on the main page_ cached_ network_ image。 The url of this image is invalid Jumping to the next page will report this error

cached_network_image: ^3.2.2 code: Container( margin: const EdgeInsets.only(left: 20, top: 54), child: ClipOval( child: CachedNetworkImage( imageUrl: avatorUrl??'', height: 64, width: 64, fit: BoxFit.fill, progressIndicatorBuilder: (context, url, downloadProgress) => CircularProgressIndicator(value: downloadProgress.progress), errorWidget: (context, url, error) => Image.asset( 'assets/images/profile/head-portrait.png', width: 36, height: 36, fit: BoxFit.fill, ), )), )

======== Exception caught by image resource service ================================================ The following _Exception was thrown resolving an image codec: Exception: Invalid image data

When the exception was thrown, this was the stack: #0 _futurize (dart:ui/painting.dart:5886:5) #1 ImageDescriptor.encoded (dart:ui/painting.dart:5741:12) #2 instantiateImageCodecFromBuffer (dart:ui/painting.dart:2092:60) #3 PaintingBinding.instantiateImageCodecFromBuffer (package:flutter/src/painting/binding.dart:153:15) #4 ImageLoader.loadBufferAsync. (package:cached_network_image/src/image_provider/_image_loader.dart:68:22) #5 ImageLoader._load (package:cached_network_image/src/image_provider/_image_loader.dart:121:25) #6 new MultiImageStreamCompleter. (package:cached_network_image/src/image_provider/multi_image_stream_completer.dart:25:18) Image provider: CachedNetworkImageProvider("http://94.74.17.115/wallet-app/img/public/20221025/05hjd8b00eb47a2ad1580ec9df89456/11/635791ac6292b5aef572a183.png", scale: 1.0) Image key: CachedNetworkImageProvider("http://94.74.17.115/wallet-app/img/public/20221025/05hjd8b00eb47a2ad1580ec9df89456/11/635791ac6292b5aef572a183.png", scale: 1.0): CachedNetworkImageProvider("http://94.74.17.115/wallet-app/img/public/20221025/05hjd8b00eb47a2ad1580ec9df89456/11/635791ac6292b5aef572a183.png", scale: 1.0)

bxxasn avatar Nov 03 '22 03:11 bxxasn

Same error here

This error appears when there is a lot of images on the same screen This package is not able to download every one in the same time (how can we treat it?)

Captura de Tela 2022-11-22 às 23 29 57 Captura de Tela 2022-11-22 às 23 30 05

marcellocamara avatar Nov 23 '22 02:11 marcellocamara

same issue.

ngonhat94 avatar Dec 07 '22 14:12 ngonhat94

Looks related to #778

I am not sure if it's related to the SSL issue below or not: https://stackoverflow.com/questions/69511057/flutter-on-android-7-certificate-verify-failed-with-letsencrypt-ssl-cert-after-s

ming-chu avatar Dec 12 '22 04:12 ming-chu

Have you found any solution ? @marcellocamara @ngonhat94

HeyRonak avatar Dec 23 '22 06:12 HeyRonak

You can try other package: https://pub.dev/packages/extended_image

ngonhat94 avatar Dec 23 '22 07:12 ngonhat94

same issue.

zhuwei avatar Sep 21 '23 08:09 zhuwei

I have the same issue.

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.83.0) [✓] Connected device (3 available) [✓] Network resources

• No issues found!

I have tried Image.network, CachedNetworkImageProvider, and ExtendedNetworkImageProvider with the same error flutter: Exception: Invalid image data.

Here is the image link that I'm trying to load: Image

rnewquist avatar Oct 30 '23 02:10 rnewquist

For those who are getting these crash as fatal crash. https://medium.com/@rishyash8/flutter-firebase-crash-report-because-of-connection-closed-before-full-header-was-received-7ace6e84bc5d

Rishyash avatar Jan 20 '24 15:01 Rishyash

Sill not solved :(

E/FlutterJNI( 5967): android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'unimplemented'Input contained an error. E/FlutterJNI( 5967): at android.graphics.ImageDecoder.nCreate(Native Method) E/FlutterJNI( 5967): at android.graphics.ImageDecoder.-$$Nest$smnCreate(Unknown Source:0) E/FlutterJNI( 5967): at android.graphics.ImageDecoder$ByteBufferSource.createImageDecoder(ImageDecoder.java:254) E/FlutterJNI( 5967): at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1981) E/FlutterJNI( 5967): at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1973) E/FlutterJNI( 5967): at io.flutter.embedding.engine.FlutterJNI.decodeImage(FlutterJNI.java:559)

both of these throws the same error CachedNetworkImage( imageUrl: thumbUrl, width: 30, height: 30, ),

CircleAvatar( radius: 30, backgroundImage: CachedNetworkImageProvider(thumbUrl))

However if i use NetworkImage(thumbUrl) it works just perfect.

Here's some sample images i'm using: image1 image2

mixmaker avatar Apr 11 '24 06:04 mixmaker

I have the same issue.

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.83.0) [✓] Connected device (3 available) [✓] Network resources

• No issues found!

I have tried Image.network, CachedNetworkImageProvider, and ExtendedNetworkImageProvider with the same error flutter: Exception: Invalid image data.

Here is the image link that I'm trying to load: Image

Hey, Brother I Tried the Image with [ CachedNetworkImage, Image.Network ] it is Working Fine. image

For Everyone Having Same Problem: Check Following things First.

  1. Network[internet] is working.
  2. Network Request is Okay [URL is Working].
  3. Response you are getting is correct and well formatted as per your requirement [ check browser's Inspect]

Sahilkumr avatar Apr 18 '24 08:04 Sahilkumr

Same here, any fix ?

joseluisonelife avatar Apr 23 '24 15:04 joseluisonelife

don't use "CachedNetworkImageProvider" try to use "CachedNetworkImage"

Hemant88080 avatar Apr 24 '24 09:04 Hemant88080

Same problem here

wantroba avatar Aug 01 '24 12:08 wantroba