Skip to content

Flutter version 3.7 is not reading asset variants #121474

@anqit

Description

@anqit

Steps to Reproduce

Running into #119462 still.
I am developing an app and am testing mostly in the mobile simulators. I have different config files for the different platforms that I have specified in the assets section of pubspec.yaml and am relying on variants to modify the config files per environment. So my assets section looks like this:

  assets:
    # ... other assets
    - config/android.json
    - config/ios.json

while my directory structure looks something like

config/
    local/    // <- directory per env
        android.json
        ios.json
    dev/
        android.json
        ios.json
    prod/
        android.json
        ios.json
 // etc

This has been working for me while using flutter up to version 3.3.10. However, after upgrading to 3.7, starting the app in at least the iOS simulator leads to the error No file or variants found for asset: config/android.json. After flutter downgrade 3.3.10, my app works as before.

Expected results:
App runs as before, asset variants are found and accessible

Actual results:
Error finding non-variant asset

Reproduction
This repo is a minimal reproduction of the issue: https://github.com/anqit/asset_variant_failure_repro

Details Flutter doctor output for downgraded, functioning version:
$flutter doctor -v
[!] Flutter (Channel unknown, 3.3.10, on macOS 11.6.1 20G224 darwin-x64, locale en-US)
    ! Flutter version 3.3.10 on channel unknown at /usr/local/Caskroom/flutter/3.0.1/flutter
    ! Upstream repository unknown
    • Framework revision 135454af32 (2 months ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/ankit/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13C100
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 71.3.6
    • Dart plugin version 223.8214.16

[✓] Connected device (3 available)
    • iPhone 13 (mobile) • 521F6361-7E1B-4F3A-A40D-81AAC09D220E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)    • macos                                • darwin-x64     • macOS 11.6.1 20G224 darwin-x64
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 110.0.5481.177

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Flutter doctor output for upgraded, non-functioning version:

$ flutter doctor -v
[✓] Flutter (Channel stable, 3.7.5, on macOS 11.6.1 20G224 darwin-x64, locale en-US)
    • Flutter version 3.7.5 on channel stable at /usr/local/Caskroom/flutter/3.0.1/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c07f788888 (3 days ago), 2023-02-22 17:52:33 -0600
    • Engine revision 0f359063c4
    • Dart version 2.19.2
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/ankit/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13C100
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 71.3.6
    • Dart plugin version 223.8214.16

[✓] Connected device (3 available)
    • iPhone 13 (mobile) • 521F6361-7E1B-4F3A-A40D-81AAC09D220E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • macOS (desktop)    • macos                                • darwin-x64     • macOS 11.6.1 20G224 darwin-x64
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 110.0.5481.177

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: assetsPackaging, accessing, or using assetsc: regressionIt was better in the past than it is nowfound in release: 3.7Found to occur in 3.7found in release: 3.8Found to occur in 3.8frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions