Skip to content

Unable to load asset in master #14220

@kentcb

Description

@kentcb

Steps to Reproduce

I have an image asset that works fine in dev. However, if I flutter channel master and flutter clean it no longer loads:

I/flutter (29513): ══╡ EXCEPTION CAUGHT BY SERVICES ╞══════════════════════════════════════════════════════════════════
I/flutter (29513): The following assertion was thrown resolving an image codec:
I/flutter (29513): Unable to load asset: assets\3.0x\logo.png
I/flutter (29513): 
I/flutter (29513): When the exception was thrown, this was the stack:
I/flutter (29513): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221)
I/flutter (29513): <asynchronous suspension>
I/flutter (29513): #1      AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:384)
I/flutter (29513): <asynchronous suspension>
I/flutter (29513): #2      AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:369)
I/flutter (29513): #3      ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:266)
I/flutter (29513): #4      ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:82)
I/flutter (29513): #5      ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:266)
I/flutter (29513): (elided 8 frames from package dart:async)
I/flutter (29513): 
I/flutter (29513): Image provider: AssetImage(bundle: null, name: "assets/logo.png")
I/flutter (29513): Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#f3f46(), name: "assets\3.0x\logo.png",
I/flutter (29513): scale: 1.0)

My pubspec looks like:

flutter:
  uses-material-design: true
  assets:
    - assets/logo.png

I have tried a release build via flutter build apk and the problem persists there. I unzipped the APK and verified that the images are in fact present and do appear to be in the correct location.

Logs

See above.

Flutter Doctor

[√] Flutter (on Microsoft Windows [Version 10.0.16299.192], locale en-AU, channel master)
    • Flutter version 0.0.21-pre.287 at C:\Users\kent\Repository\flutter
    • Framework revision 159db5ca44 (2 days ago), 2018-01-20 14:43:23 -0800
    • Engine revision e45eb692b1
    • Tools Dart version 2.0.0-dev.16.0
    • Engine Dart version 2.0.0-edge.93d8c9fe2a2c22dc95ec85866af108cfab71ad06

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Android\android-sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = C:\Android\android-sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[√] Android Studio (version 3.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[√] IntelliJ IDEA Community Edition (version 2017.3)
    • Flutter plugin version 20.0.3
    • Dart plugin version 173.4127.31

[√] Connected devices
    • Pixel • FA6AF0303979 • android-arm • Android 8.1.0 (API 27)

Repro

repro.zip

Running this on the alpha channel works as expected (a black rectangular image displays centered on screen). However, if I switch to master I get the above error.

I'm running this on a Pixel 5" using Windows 10 as my development machine.

Aside: flutter channel dev is not currently working for me - it just does nothing, leaving you on the existing channel, which was hell confusing. Using git checkout dev in the flutter repo did exactly the same thing (nothing). git branch -a shows remotes/origin/dev, so not sure what's going on :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform-windowsBuilding on or for Windows specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions