Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: Invalid image data #797

Open
bxxasn opened this issue Nov 3, 2022 · 12 comments
Open

Exception: Invalid image data #797

bxxasn opened this issue Nov 3, 2022 · 12 comments

Comments

@bxxasn
Copy link

bxxasn commented Nov 3, 2022

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)

@marcellocamara
Copy link

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

@ngonhat94
Copy link

same issue.

@ming-chu
Copy link

ming-chu commented Dec 12, 2022

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

@HeyRonak
Copy link

Have you found any solution ? @marcellocamara @ngonhat94

@ngonhat94
Copy link

ngonhat94 commented Dec 23, 2022

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

@zhuwei
Copy link

zhuwei commented Sep 21, 2023

same issue.

@rnewquist
Copy link

rnewquist commented Oct 30, 2023

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

@Rishyash
Copy link

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

@mixmaker
Copy link

mixmaker commented Apr 11, 2024

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

@Sahilkumr
Copy link

Sahilkumr commented Apr 18, 2024

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]

@joseluisonelife
Copy link

Same here, any fix ?

@Hemant88080
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests