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

[Bug]: Splashscreen not working #7857

Open
1 of 3 tasks
Toto5931 opened this issue Feb 1, 2025 · 0 comments
Open
1 of 3 tasks

[Bug]: Splashscreen not working #7857

Toto5931 opened this issue Feb 1, 2025 · 0 comments
Labels

Comments

@Toto5931
Copy link

Toto5931 commented Feb 1, 2025

Capacitor Version

Latest Dependencies:

@capacitor/cli: 7.0.1
@capacitor/core: 7.0.1
@capacitor/android: 7.0.1
@capacitor/ios: 7.0.1

Installed Dependencies:

@capacitor/ios: not installed
@capacitor/cli: 6.0.0
@capacitor/core: 6.0.0
@capacitor/android: 6.0.0

Other API Details

npm 8.19.4
node v20.14.0

Package.json

{
  "name": "app3",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "live": "vite --config vite.config.live.js",
    "build": "vite build",
    "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
    "preview": "vite preview"
  },
  "dependencies": {
    "@capacitor/android": "^6.0.0",
    "@capacitor/app": "^6.0.0",
    "@capacitor/core": "^6.0.0",
    "@capacitor/splash-screen": "^6.0.3",
    "@capacitor/text-zoom": "^6.0.3",
    "@capawesome/capacitor-app-update": "^6.1.0",
    "@tanstack/react-query": "^5.54.1",
    "@tanstack/react-query-devtools": "^5.54.1",
    "axios": "^1.7.2",
    "dayjs": "^1.11.11",
    "framer-motion": "^11.2.10",
    "i18next": "^23.11.5",
    "i18next-browser-languagedetector": "^8.0.0",
    "i18next-chained-backend": "^4.6.2",
    "i18next-http-backend": "^2.5.2",
    "i18next-localstorage-backend": "^4.2.0",
    "react": "^18.2.0",
    "react-datepicker": "^6.9.0",
    "react-dom": "^18.2.0",
    "react-i18next": "^14.1.2",
    "react-quill-new": "^3.3.3",
    "react-router-dom": "^6.23.1",
    "react-select": "^5.8.3"
  },
  "devDependencies": {
    "@capacitor/cli": "^6.0.0",
    "@tanstack/eslint-plugin-query": "^5.53.0",
    "@types/react": "^18.2.66",
    "@types/react-dom": "^18.2.22",
    "@vitejs/plugin-react": "^4.2.1",
    "eslint": "^8.57.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-react": "^7.34.1",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.6",
    "vite": "^5.2.0"
  }
}

capacitor.config.json

{
  "appId": "xxx",
  "appName": "xxx",
  "webDir": "dist",
  "backgroundColor": "#2c373f",
  "plugins": {
    "CapacitorCookies": {
      "enabled": true
    },
    "CapacitorHttp": {
      "enabled": true
    },
    "SplashScreen": {
      "launchShowDuration": 3000,
      "backgroundColor": "#2c373f",
      "androidScaleType": "CENTER_CROP"
    }
  }
}

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

On Android 9: The aspect ratio of the splashscreen is not kept (despite "androidScaleType": "CENTER_CROP" in SplashScreen plugin configuration)
On Android 15: The splashscreen is based on the icon: ok

I can keep the aspect ratio on Android 9 by changing \android\app\src\main\res\values\styles.xml from

    <style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
        <item name="android:background">@drawable/splash</item>
    </style>

to

<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
        <item name="android:windowIsTranslucent">true</item> // (when this line is not present a white screen appears before the splashscreen on android 9)
 </style>

This solves the problem on Android 9 but on Android 15 no splashscreen appears anymore

Expected Behavior

I would like to see a good behavior on all android versions
on Android 9: my splashscreen with a good aspect ratio, or a splashscreen based on the icon (core-splashscreen library? but how to do?)
on Android 15: the splashscreen is based on the icon

As I am not an Android developper (this is way I use capacitor) I do not understand anything of android environement. Please explain how to do. The documentation is insufficient
Thanks

Project Reproduction

none

Additional Information

No response

@Toto5931 Toto5931 added the triage label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant