简体   繁体   中英

Phonegap made android app shows black screen

I have been battling with this for the past week and have made little to no progress with it. Initially When I made my app with phonegap for the first time it would show a black screen and nothing else. I since added a splash screen and changed the background color in the config.xml and since then it has shown the splash screen and after it goes it shows a white screen instead of a black one.

The app works fine as a website so I really don't know where to start debugging. The phonegap build debugger comes up with nothing, as in it doesn't show any elements of the app at all.

Is it normal for a phonegap app to show a black screen when something is wrong or should there be an error message of some sort? If so, what is there that can be done about it?

Usually such black screens occur when there is an error in one of the plugins. Using plugins without adding them to the .xml file (or adding them incorrectly), deviceready issues of having to wait for the device to load before accessing any plugins. I don't know much about phonegap since I use mainly Cordova + Intel XDK to take care of all that could go wrong (and many things could go wrong with Cordova plugins).

My suggestion is try to disable all plugins and then see if it works. If it does, start enabling them one by one to see which one is causing the error. That is of course if you could not see the console errors straight away.

I had this same issue with the iPhone going to a black screen. There were no errors in the iPhone log or in the html log. The issue was the plugin for StatusBar: cordova-plugin-statusbar

Try to manage duration with:

<preference name="splash-screen-duration" value="10"/>

10 — it's value in miliseconds. 1000 is 1 second for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM