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

Unable to load asset / cached image #42998

Closed
Chatenaisien opened this issue Oct 18, 2019 · 3 comments
Closed

Unable to load asset / cached image #42998

Chatenaisien opened this issue Oct 18, 2019 · 3 comments
Labels
a: assets Packaging, accessing, or using assets c: crash Stack traces logged to the console framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically

Comments

@Chatenaisien
Copy link

Hi Flutter community !

My App have a button to share images loaded from internet. The code is working fine on iOS.
But on Android, the first attempt never works. rootBundle throws an Exception(Unable to load asset).
The rootBundle only find the cached file after a hot restart. So release versions never work :(
==> If I re Run the app, the problem vanish until the next uninstall and reinstall of the app.

I'm using the flutter-cache-manager and esys-flutter-share packages.
And I tried Flutter Clean. Flutter Upgrade. on dev/beta/master channels.

shareMedia(int index) async {

    var file = await DefaultCacheManager().getSingleFile(imageLink);

    final ByteData bytes = await rootBundle.load(file.path);
    await Share.file('Hi !!', 'image.png', bytes.buffer.asUint8List(), 'image/png');
  } 
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.10.14, on Mac OS X 10.14.6 18G95, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.38.1)
[✓] Connected device (3 available)
• No issues found!

Any ideas ?

Thanks a lot ! 🙏

@BondarenkoStas BondarenkoStas added a: assets Packaging, accessing, or using assets platform-android Android applications specifically labels Oct 18, 2019
@weishirongzhen
Copy link

I had same problem, change channel to stable will solved.

@VladyslavBondarenko VladyslavBondarenko added passed first triage framework flutter/packages/flutter repository. See also f: labels. c: crash Stack traces logged to the console and removed passed first triage labels Jan 15, 2020
@TahaTesser
Copy link
Member

Hi @Chatenaisien
Please check this comment for solution

if you're still experiencing this problem, please create a new issue and provide the information required in the template.
Thank you

@lock
Copy link

lock bot commented Apr 4, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@lock lock bot locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: assets Packaging, accessing, or using assets c: crash Stack traces logged to the console framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically
Projects
None yet
Development

No branches or pull requests

5 participants