Closed egealpay closed 2 years ago
@egealpay I don't have such devices to test this. Just in case, can you provide your styles.xml, the content of your res/layout directory?
I recommend checking in the Google issue tracker for similar issues. It looks like a bug in AndroidX core splashscreen module (or in Oppo / Realme android forks), not really related to this library bindings (but it could be nice to solve this in AndroidX tho).
EDIT: The layout is embed in the core module and is not complex. I don't know what this phones do to fuck this up.
@zoontek Here is the styles.xml file:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
+ <!-- BootTheme should inherit from Theme.SplashScreen -->
<style name="BootTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/petrol</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
</resources>
I have single file in res/layout
which is unrelated with splash screen.
I will check Google Issue Tracker, as you stated, it is probably related with Oppo and RealMe forks. (Which is out of scope of this library). I will try to find an Oppo devices. If I find any more information, I will let you know.
Thanks
@egealpay This might sound weird, but as you have an app layout
directory, try copy & paste the splash_screen_view.xml
file inside it, just in case.
That's not how Android is supposed to works, but hey, these phones don't run "proper" Android versions 😅
I will try that 😄
@zoontek @egealpay
I am having this exact bug. I can repro it in Android 11 emulator. Android 12 works fine.
Removing rn-bootsplash fixes the problem for me -- which causes me to think there are weird interactions going on with the RNBootsplash package.
I've tried your suggestion @zoontek of copying & pasting the splash_screen_view.xml file inside my project. Although it doesn't fully fix the issue, removing all children and making layout/splash_screen_view.xml
as follows, allows the app to load.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="false"
android:fitsSystemWindows="false">
</FrameLayout>
This however doesn't allow us to see the bootsplash screen. Only a blank page.
@zoontek could something inside super.onCreate
try to execute and access layout/splash_screen_view
and prevent bootsplash from working?
@Override
protected void onCreate(Bundle savedInstanceState) {
RNBootSplash.init(this); // <- initialize the splash screen
super.onCreate(savedInstanceState); // or super.onCreate(null) with react-native-screens
}
Update:
The problem was with a renaming of the Theme.SlashScreen
properties that we wish to override. [1]
Changing your android/app/src/main/res/values/styles.xml file to:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Your base theme customization -->
</style>
<!-- BootTheme should inherit from Theme.SplashScreen -->
<style name="BootTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/bootsplash_background</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item>
+ <item name="android:windowSplashScreenBackground">@color/bootsplash_background</item>
+ <item name="android:windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item>
<item name="postSplashScreenTheme">@style/AppTheme</item>
</style>
</resources>
almost fixes the issue -- the splash screen still however doesn't show for a long time and all we see is a blank BG.
@egealpay This might sound weird, but as you have an app
layout
directory, try copy & paste thesplash_screen_view.xml
file inside it, just in case.That's not how Android is supposed to works, but hey, these phones don't run "proper" Android versions 😅
Today I got the OPPO device to produce this bug. As you mentioned, I have created splash_screen_view.xml
file and placed a FrameLayout with background color. Bug is gone, however it shows a default white screen for Splash Screen
@egealpay Just thought about it again, and unfortunately this is not a viable solution. Did you ask on Google issue tracker?
@zoontek I think I found the issue on Google Issue Tracker: https://issuetracker.google.com/issues/207386164
When I try to open the app from application list, it is crashing. But If I click a dynamic link, it opens the app by showing the splashing screen without any error. Probably phone application launcher causes this error.
Also I have created a new issue: https://issuetracker.google.com/issues/256543973
@zoontek I have fixed the problem, it was causing because of a very simple mistake that I did in manifest file.
I was trying to set theme both for Application and Activity.
<application
android:name=".MainApplication"
...
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
...
android:theme="@style/BootTheme">
</activity>
</application>
I changed it to use BootTheme only in Application and nothing in Activity. Now, Splash screen works on OPPO phones.
@egealpay Thanks for the feedback! It will help people searching for similar issues 🙂
Bug summary
Hi,
According to Firebase logs, my app is crashing when setOnExitAnimationListener called, on OPPO and RealMe devices with Android 9 and 10. I have tried on Samsung, Huawei, Lenovo and Xiaomi but could not generate the bug.
Here is the logs of the crash:
More detailed logs:
I don't have a file called as
splash_screen_view
. I have checked some files inandroidx.core:core-splashscreen
and saw the following code inSplashScreenViewProvider.kt
file:This code is trying to access
splash_screen_view
and I believe that is it reason of the crash.Library version
4.3.2
Environment info
Steps to reproduce
I could not generate the bug in my test devices, but according to Firebase, app crashes after these steps:
Reproducible sample code