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

pub finished with exit code 255 #3

Closed
lubi888 opened this issue Aug 26, 2019 · 14 comments
Closed

pub finished with exit code 255 #3

lubi888 opened this issue Aug 26, 2019 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@lubi888
Copy link

lubi888 commented Aug 26, 2019

Hi,

Just saw your link on reddit and wanted to give it a try.

Here's the error code:
flutter pub pub run flutter_native_splash:create [Android] Creating splash images [Android] Updating launch_background.xml with splash image path [iOS] Creating splash images [iOS] Updating LaunchScreen.storyboard with width, height and color Unhandled exception: RangeError: Invalid value: Only valid value is 0: -1 #0 List.insert (dart:core-patch/growable_array.dart:11:7) #1 _updateLaunchBackgroundFileWithImagePath (package:flutter_native_splash/android.dart:104:11) <asynchronous suspension> #2 _applyLaunchBackgroundXml (package:flutter_native_splash/android.dart:77:12) #3 createSplash (package:flutter_native_splash/android.dart:26:9) <asynchronous suspension> #4 createSplash (package:flutter_native_splash/flutter_native_splash.dart:18:5) #5 main (file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_native_splash-0.1.4/bin/create.dart:5:3) #6 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32) #7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12) pub finished with exit code 255

@lubi888
Copy link
Author

lubi888 commented Aug 26, 2019

I can add some details as it looks like most of the programming worked. I'll list what was changed here. I'm using Win 10.

There are 5 new resources in app/src/main/res alongside the normal 'mipmap-hdpi', etc. and these are 'drawable-hdpi', 'drawable-mdpi' etc.

drawable\launch_background.xml has been deleted
res\values\colors.xml has been created and is clean.
res\values\styles.xml has been deleted and not written to. This is an error.

ios\Runner\AppDelegate.m has been deleted. Another error?
ios\Runner\Info.plist has been deleted. ?
it looks like all the assets of 2x and 3 x were added correctly to ios

ok, let me know if I can help in any way.

@henriquearthur
Copy link
Collaborator

Thank you for reporting this.

We are dealing with two different issues here.

First issue
It seems like an error occurred when the package was trying to update launch_background.xml. That can happen if the package can't find the line containing android:src="@drawable/splash", which comes by default on a new Flutter project, or for some reason it could not read the lines on that file.

Can you provide the content of app/src/main/res/drawable/launch_background.xml so I can investigate this?

Second issue
This issue is related to files being deleted or created empty. This package previously ran every non-depend step of creating a splash screen asynchronously. That means, in your case, that the steps below were running at the same time.

[Android] Updating launch_background.xml with splash image path
[iOS] Creating splash images
[iOS] Updating LaunchScreen.storyboard with width, height and color

If any of these steps throws an Exception (which was exactly what happened) the package stops running, even if any others steps are not finished yet. This is not ideal because it can create empty files or update by half.

I fixed this issue on version 0.1.5 by making every step run synchronously. If some step throws an Exception, it will not cause side effects.

Please update the package before running it again.

@henriquearthur henriquearthur added bug Something isn't working waiting response Further information is requested labels Aug 26, 2019
@henriquearthur henriquearthur self-assigned this Aug 26, 2019
@htsnet
Copy link

htsnet commented Aug 26, 2019

flutter pub pub run flutter_native_splash:create
[Android] Creating splash images
[Android] Updating launch_background.xml with splash image path
[Android] Updating colors.xml with color for splash screen background
[Android] Updating styles.xml with full screen mode setting
Unhandled exception:
*** ERROR [flutter_native_splash] ***
CantFindMainActivityPath
Not able to determinate MainActivity path. Maybe the problem is your package path OR your AndroidManifest.xml 'package' attribute on manifest.
#0 _javaOrKotlin (package:flutter_native_splash/android.dart:289:5)

#1 _applyMainActivityUpdate (package:flutter_native_splash/android.dart:263:33)

#2 createSplash (package:flutter_native_splash/android.dart:33:9)

#3 createSplash (package:flutter_native_splash/flutter_native_splash.dart:18:11)

#4 main (file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_native_splash-0.1.5/bin/create.dart:5:3)
#5 _startIsolate. (dart:isolate-patch/isolate_patch.dart:303:32)
#6 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
pub finished with exit code 255

@henriquearthur
Copy link
Collaborator

@htsnet the package couldn't find MainActivity file to update. Are you using Java or Kotlin?

If it is Java:
Can you confirm your MainActivity.java is located at android/app/src/main/java/com/example/YOUR_PACKAGE/MainActivity.java?

If it is Kotlin:
Can you confirm your MainActivity.kt is located at android/app/src/main/kotlin/com/example/YOUR_PACKAGE/MainActivity.kt?

@htsnet
Copy link

htsnet commented Aug 27, 2019

@henriquearthur
MainActivity.java is at ...\SemContato\android\app\src\main\java\br\com\htsnet\sem_contato\MainActivity.java

I don´t have /kotlin folder

@henriquearthur
Copy link
Collaborator

@htsnet thank you for reporting. The package could not find MainActivity because of custom package name. Version 0.1.6 fixes the problem. Update the package and run again.

This is not related to the issue by @lubi888.

@htsnet
Copy link

htsnet commented Aug 27, 2019

@henriquearthur It works now. Thank you! Great job.

@lubi888
Copy link
Author

lubi888 commented Aug 27, 2019

Hi Henrique,

Having fun publishing?!

Here’s the contents of drawable.xml that was deleted yesterday by the release version.

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />

<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

I created this flutter app recently using Android Studio because I had to upgrade my whole flutter project to AndroidX. I didn’t use the ‘flutter create’ command to create this app.

I have check this again and just created a new flutter app using Android and the output is the same as what I already have and is shown above. Thus, there is no line you referred to android:src="@drawable/splash

I have just created a sample app using ‘flutter create’ and the output is the same as using Android Studio.

Ok, I’ve just installed your updated code and here are the results for 0.1.6

flutter pub pub run flutter_native_splash:create

[Android] Creating splash images
[Android] Updating launch_background.xml with splash image path
[Android] No colors.xml file found in your Android project
[Android] Creating colors.xml file and adding it to your Android project
[Android] Updating styles.xml with full screen mode setting
[iOS] Creating splash images
[iOS] Updating LaunchScreen.storyboard with width, height and color
[iOS] Updating Info.plist for status bar hidden/visible
[iOS] Updating AppDelegate for status bar hidden/visible

The process took about 30 seconds to create all the files correctly. The good news is that all is working now :-)
Here’s a shot from GitHub desktop that shows how launch_background.xml was added to.
Annotation 2019-08-27 122846

Should I say ‘merci’ or ‘obrigado’ Henrique? Thanks. Plugin is working now and I find it easier to use than the other splash plugins.

@lubi888 lubi888 closed this as completed Aug 27, 2019
@henriquearthur
Copy link
Collaborator

@lubi888 my apologies. I said that:

android:src="@drawable/splash", which comes by default on a new Flutter project

But that's not true. That line is added by flutter_native_splash to reference the splash image. (probably said that confusing with iOS). Not sure why the package couldn't read the launch_background.xml lines causing the first error.

Anyway, glad it's working for you.

It's actually "obrigado" as I am from Brazil. First publish so far it's actually a very good experience!

Thanks. :)

@henriquearthur henriquearthur added android and removed waiting response Further information is requested labels Aug 27, 2019
@thisisddzin
Copy link

In my case the problem was that I had changed the package name com.example for com.mydomain and forget of change already the android path name.

If that is you case too try change here like that:
android/app/src/main/com/<change here 'example' for your domain>/...

@joaovirgili
Copy link

My package: com.geekbusinesslab.PepsRelatorios.
My MainActivity path is android/app/src/main/kotlin/com/example/pepsfield_relatorios_app/MainActivity.kt

what should i do?

@corymalcolmtaylor
Copy link

corymalcolmtaylor commented Apr 22, 2020

Have you tried renaming the folder to android/app/src/main/kotlin/com/geekbusinesslab/pepsfield_relatorios_app/MainActivity.kt

I dd that and now the create command completes and the launch image works on my android emulator. However it still does not show up on my ios simulator (iphone SE 2nd gen). I just see a black screen until my app shows up.

Flutter 1.17.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision d3ed9ec945 (2 weeks ago) • 2020-04-06 14:07:34 -0700
Engine • revision c9506cb8e9
Tools • Dart 2.8.0 (build 2.8.0-dev.18.0 eea9717938)

I can't get a launch screen to work on the ios sim by other any other methods (Xcode) either so it is probably not a problem with this package.

@kunjmehta-123
Copy link

C:\flutterApps\newsplash>flutter pub pub run flutter_native_splash:create
[Android] Creating splash images
[Android] Updating launch_background.xml with splash image path
[Android] No colors.xml file found in your Android project
[Android] Creating colors.xml file and adding it to your Android project
[Android] Updating styles.xml with full screen mode setting
Unhandled exception:
FormatException: Invalid radix-16 number (at character 1)
“4
^

#0 int._throwFormatException (dart:core-patch/integers_patch.dart:131:5)
#1 int._parseRadix (dart:core-patch/integers_patch.dart:142:16)
#2 int._parse (dart:core-patch/integers_patch.dart:100:12)
#3 int.parse (dart:core-patch/integers_patch.dart:63:12)
#4 new HexColor (package:color/hex_color.dart:21:17)
#5 _generatePrimaryColorDarkFromColor (package:flutter_native_splash/android.dart:48:45)
#6 createSplash (package:flutter_native_splash/android.dart:42:34)

#7 createSplash (package:flutter_native_splash/flutter_native_splash.dart:20:11)

#8 main (file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_native_splash-0.1.9/bin/create.dart:5:3)
#9 _startIsolate. (dart:isolate-patch/isolate_patch.dart:299:32)
#10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
pub finished with exit code 255

This is the error I'm getting. Anything I can do about this?

@lukepighetti
Copy link

lukepighetti commented Jun 30, 2020

My package name is twic.app, how can I proceed?

Edit: ended up doing android/app/src/main/kotlin/twic/app/MainActivity.kt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants