apache / cordova-plugin-splashscreen

Apache Cordova Plugin splashscreen
Apache License 2.0
643 stars 639 forks source link

Electron/Browser JS crash, SplashScreenProxy #244

Open globules-io opened 4 years ago

globules-io commented 4 years ago

Bug Report

Command or Code

cordova plugin add cordova-plugin-splashscreen@latest
cordova platform add electron@latest
cordova run electron  --nobuild
<platform name="browser">
        <preference name="SplashScreen" value="/res/screens/browser/land-480x320-screen.png" />
        <preference name="AutoHideSplashScreen" value="true" />
        <preference name="SplashScreenDelay" value="3000" />
        <preference name="ShowSplashScreen" value="true" />
        <preference name="SplashScreenWidth" value="480" />
        <preference name="SplashScreenHeight" value="320" />
 </platform>

What does actually happen?

adding proxy for SplashScreen
SplashScreenProxy.js:80 Uncaught TypeError: Cannot read property 'appendChild' of null
    at Object.show (SplashScreenProxy.js:80)
    at showAndHide (SplashScreenProxy.js:143)
    at SplashScreenProxy.js:158
    at XMLHttpRequest.xhrStatusChangeHandler (cordova.js:902)

Environment, Platform, Device

cordova@9.0.0 cordova-lib@9.0.1 cordova-plugin-splashscreen@5.0.3 cordova-electron@1.1.1.

Checklist

Kepro commented 4 years ago

Did you try <platform name="electron"> ?

globules-io commented 4 years ago

Try where?

Kepro commented 4 years ago

in config.xml

globules-io commented 4 years ago
<platform name="electron">
        <preference name="ElectronSettingsFilePath" value="res/electron/settings.json" />
    </platform>
Kepro commented 4 years ago

dude, just put what you have under browser platform under electron platform

globules-io commented 4 years ago

@Kepro, please stop being so cryptic ... No idea what you mean. Post code or just .... you know?

Kepro commented 4 years ago

this

`

    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="SplashScreenDelay" value="3000" />
    <preference name="ShowSplashScreen" value="true" />
    <preference name="SplashScreenWidth" value="480" />
    <preference name="SplashScreenHeight" value="320" />

`

globules-io commented 4 years ago

Thanks I will try that

globules-io commented 4 years ago
 <platform name="electron">
        <preference name="ElectronSettingsFilePath" value="res/electron/settings.json" />
        <preference name="SplashScreen" value="res/screens/electron/land-480x320-screen.png" />
        <preference name="AutoHideSplashScreen" value="true" />
        <preference name="SplashScreenDelay" value="3000" />
        <preference name="ShowSplashScreen" value="true" />
        <preference name="SplashScreenWidth" value="480" />
        <preference name="SplashScreenHeight" value="320" />
    </platform> 
adding proxy for SplashScreen
SplashScreenProxy.js:80 Uncaught TypeError: Cannot read property 'appendChild' of null
    at Object.show (SplashScreenProxy.js:80)
    at showAndHide (SplashScreenProxy.js:143)
    at SplashScreenProxy.js:158
    at XMLHttpRequest.xhrStatusChangeHandler (cordova.js:902)
land-480x320-screen.png:1 Failed to load resource: net::ERR_FILE_NOT_FOUND

I guess image is not copied over? Note that res/screens/electron/land-480x320-screen.png exists.

Kepro commented 4 years ago

run cordova with -d to see log

globules-io commented 4 years ago
  copy  platforms\electron\platform_www\plugins\cordova-plugin-splashscreen\src\browser\SplashScreenProxy.js platforms\electron\www\plugins\cordova-plugin-splashscreen\src\browser\SplashScreenProxy.js (updated file)
  copy  platforms\electron\platform_www\plugins\cordova-plugin-splashscreen\www\splashscreen.js platforms\electron\www\plugins\cordova-plugin-splashscreen\www\splashscreen.js (updated file)

This app does not have splash screens defined.

The file is never moved.

ryanflores-bayalarm commented 1 year ago

I know that this is really old and I apologize for grave digging, but I just wanted to provide some information in regards to this and how I got cordova-plugin-splashscreen to work with Electron. This issue is what helped me troubleshoot the issue... especially with the recommendation of the -d command line option.

Basically, the way I resolved this issue was by:

For that last bullet, please take note that I specifically mentioned the platform_www directory and not www. Whenever you run/build the app, the plugin(s) will get copied from platform_www/plugins/ to www/pugins/.

I hope anyone who comes across this will find this useful. I wasted 2-3 days just trying to figure all this out.

As far as whose responsible for fixing what, for sure the maintainers of cordova-plugin-splashscreen must fix SplashScreenProxy.js. However, in regards to <splash> and the SplashScreen preference, I have no clue who needs to address that.

exaland commented 1 year ago

This is bug for Browser platform because the cordova-plugin-splashscreen is not properly configured

Go to your config.xml file and add this

    <platform name="browser">
    <preference name="SplashScreen" value="/img/logo.png" /> <!-- defaults to "/img/logo.png" -->
    <preference name="AutoHideSplashScreen" value="true" /> <!-- defaults to "true" -->
    <preference name="SplashScreenDelay" value="3000" /> <!-- defaults to "3000" -->
    <preference name="SplashScreenBackgroundColor" value="green" /> <!-- defaults to "#464646" -->
    <preference name="ShowSplashScreen" value="false" /> <!-- defaults to "true" -->
    <preference name="SplashScreenWidth" value="600" /> <!-- defaults to "170" -->
    <preference name="SplashScreenHeight" value="300" /> <!-- defaults to "200" -->
</platform>
gnardydev commented 1 year ago

HEY BRO U SAVED ME LOVE U LOTS OF LOVE

exaland commented 1 year ago

@gnardydev You are welcome 🙏 thanks to add me an emoji 👍