zoontek / react-native-bootsplash

🚀 Show a splash screen during app startup. Hide it when you are ready.
MIT License
3.65k stars 254 forks source link

RN 0.75 not working on android #628

Closed deepankarXe closed 1 week ago

deepankarXe commented 1 week ago

Before submitting a new issue

Bug summary

Getting below error when we upgraded from RN 0.72.7 to 0.75.3 with RN 0.72.7 we were using 5.5.3 of this library with RN 0.75.3 we are using 6.1.3 of this library

i am not a expert in android development but can't figure out what is happening wrong here. can some one tell what is happening ? and how to fix it

error A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction Android resource linking failed error: resource style/Theme.BootSplash.EdgeToEdge (aka com.myapp:style/Theme.BootSplash.EdgeToEdge) not found. com.myapp.app-mergeDebugResources-24:/values/values.xml:1497: error: style attribute 'attr/bootSplashBackground (aka com.myapp:attr/bootSplashBackground)' not found. com.myapp.app-mergeDebugResources-24:/values/values.xml:1498: error: style attribute 'attr/bootSplashLogo (aka com.myapp:attr/bootSplashLogo)' not found. com.myapp.app-mergeDebugResources-24:/values/values.xml:1499: error: style attribute 'attr/postBootSplashTheme (aka com.myapp:attr/postBootSplashTheme)' not found. error: failed linking references.

Library version

6.1.3

Environment info

System:
  OS: macOS 15.0
  CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Memory: 31.00 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.10.0
    path: ~/.nvm/versions/node/v20.10.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v20.10.0/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v20.10.0/bin/npm
  Watchman:
    version: 2024.09.09.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 34.0.0
    System Images:
      - android-30 | Google APIs Intel x86 Atom
      - android-33 | Google APIs Intel x86_64 Atom
      - android-33 | Google Play Intel x86_64 Atom
      - android-34 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.19072.14.2412.12360217
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /Users/deepankaragrawal/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.3
    wanted: 0.75.3
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

  1. create a new fresh application using react-native-cli
  2. install the latest package
  3. not working

Reproducible sample code

following the same steps as per the documentation with no code changes
zoontek commented 1 week ago

It works on RN 0.75. Please publish your styles.xml

deepankarXe commented 1 week ago

Hello @zoontek , thanks for swift response

here's our style.xml

<resources xmlns:tools="http://schemas.android.com/tools">

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
    </style>
    <!-- BootTheme should inherit from Theme.BootSplash or Theme.BootSplash.EdgeToEdge -->
    <style name="BootTheme" parent="Theme.BootSplash.EdgeToEdge">
        <!-- Apply color + style to the status bar (true = dark-content, false = light-content) -->
        <item name="android:statusBarColor">@color/bootsplash_background</item>
        <item name="android:windowLightStatusBar">true</item>
        <item name="bootSplashBackground">@color/bootsplash_background</item>
        <item name="bootSplashLogo">@drawable/bootsplash_logo</item>
        <item name="postBootSplashTheme">@style/AppTheme</item>
    </style>

</resources>
zoontek commented 1 week ago

The first line is useless when using the edge-to-edge theme:

<item name="android:statusBarColor">@color/bootsplash_background</item>

Don't forget to clean your project (gradlew clean) before building it again.

deepankarXe commented 1 week ago

Thanks, for the help @zoontek , we did a goofup in the build settings we turned off auto-linking, when we enabled it back it worked like a charm

the library works like a charm on RN 0.75

Thanks for the help :)