Closed lubi888 closed 4 years ago
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.
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.
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.
@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
?
@henriquearthur MainActivity.java is at ...\SemContato\android\app\src\main\java\br\com\htsnet\sem_contato\MainActivity.java
I don´t have /kotlin folder
@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.
@henriquearthur It works now. Thank you! Great job.
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.
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 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_nativesplash 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. :)
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>/...
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?
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.
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 ^
My package name is twic.app
, how can I proceed?
Edit: ended up doing android/app/src/main/kotlin/twic/app/MainActivity.kt
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)