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

Bad state: No element error while running flutter pub run flutter_native_splash:create #136

Closed
MariiaS opened this issue Mar 1, 2021 · 6 comments
Labels
waiting response Further information is requested

Comments

@MariiaS
Copy link

MariiaS commented Mar 1, 2021

Describe the bug
I'm trying to run flutter_native_splash:create. The yaml file consist only color setting:

flutter_native_splash: color: "#489FB5"

Expected behavior
Expected that the splash is generated for both platforms

Device (please complete the following information):

  • Android Simulator

Additional context
Error stacktrace:

Restoring Flutter's default white native splash screen... [Android] Updating android/app/src/main/res/drawable/launch_background.xml with splash image path [Android] Updating android/app/src/main/res/values/colors.xml with color for splash screen background [Android] Updating styles.xml with full screen mode setting [iOS] Updating LaunchScreen.storyboard with width, and height Unhandled exception: Bad state: No element #0 Iterable.firstWhere (dart:core/iterable.dart:516:5) #1 _updateLaunchScreenStoryboard (package:flutter_native_splash/ios.dart:139:63) #2 _applyLaunchScreenStoryboard (package:flutter_native_splash/ios.dart:107:12) #3 _createiOSSplash (package:flutter_native_splash/ios.dart:66:9) <asynchronous suspension> #4 tryCreateSplashByConfig (package:flutter_native_splash/supported_platform.dart:61:5) <asynchronous suspension> #5 tryRemoveSplash (package:flutter_native_splash/supported_platform.dart:33:3) <asynchronous suspension> #6 removeSplash (package:flutter_native_splash/flutter_native_splash.dart:27:3) <asynchronous suspension> pub finished with exit code 255

@jonbhanson
Copy link
Owner

jonbhanson commented Mar 2, 2021

What version of the package are you running?

Are you sure that you ran the command flutter pub run flutter_native_splash:create? Is it possible that you mistakenly ran flutter pub run flutter_native_splash:remove?

It looks like maybe your LaunchScreen.storyboard has been modified. Can you post a copy of this file?

@jonbhanson jonbhanson added the waiting response Further information is requested label Mar 2, 2021
@yanivshaked
Copy link

Same issue here. I am running version 0.3.0 since I'm still on flutter 1.22.4. Output is:

PS C:\dev\12Tech12\git\client\tw_app> flutter pub run flutter_native_splash:create
[Android] Updating android/app/src/main/res/drawable/launch_background.xml with splash image path
[Android] No android/app/src/main/res/values/colors.xml file found in your Android project
[Android] Creating android/app/src/main/res/values/colors.xml file and adding it to your Android project
[Android] No android/app/src/main/res/drawable-night/launch_background.xml file found in your Android project
[Android] Creating android/app/src/main/res/drawable-night/launch_background.xml file and adding it to your Android project
[Android] No android/app/src/main/res/values-night/colors.xml file found in your Android project
[Android] Creating android/app/src/main/res/values-night/colors.xml file and adding it to your Android project
[Android] Updating styles.xml with full screen mode setting
[Android] Only 1 style in styles.xml. Flutter V2 embedding has 2 styles by default.  Full screen mode not supported in Flutter V1 embedding.  Skipping update of styles.xml with fullscreen mode
[iOS] Updating LaunchScreen.storyboard with width, and height
Unhandled exception:
Bad state: No element
#0      Iterable.firstWhere (dart:core/iterable.dart:578:5)
#1      _updateLaunchScreenStoryboard (package:flutter_native_splash/ios.dart:139:63)
#2      _applyLaunchScreenStoryboard (package:flutter_native_splash/ios.dart:107:12)
#3      _createiOSSplash (package:flutter_native_splash/ios.dart:66:9)
<asynchronous suspension>
#4      tryCreateSplashByConfig (package:flutter_native_splash/supported_platform.dart:61:11)
<asynchronous suspension>
#5      tryCreateSplash (package:flutter_native_splash/supported_platform.dart:27:9)
<asynchronous suspension>
#6      createSplash (package:flutter_native_splash/flutter_native_splash.dart:17:9)
#7      main (file:///c:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_native_splash-0.3.1+1/bin/create.dart:5:3)
#8      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Attaching my LaunchScreen.storyboard file.

LaunchScreen.zip

@jonbhanson
Copy link
Owner

@yanivshaked I see that in your LaunchScreen.storyboard, the resources include an image named NewLaunchImage where the default name is LaunchImage. Do you know why the name is different than the default?

@jonbhanson
Copy link
Owner

I will add a better error message so it is clear that the problem is that the LaunchImage is not found.

@yanivshaked
Copy link

You are correct - I renamed the launch image name to solve iOS spring board caching issues. I will rename it back and post the results.

@yanivshaked
Copy link

After renaming back to LaunchImage - works as expected!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting response Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants