Search code examples
androidcordovaandroid-emulatoradb

Getting a white screen with my installed app in Android emulator (however works in browser)


I am having issues getting a legacy mobile app to run in an emulator - it all seems to run in the browser without any issues but when I run the cordova emulate command the app attempts to install but I always get a white screen (nothing else) & the app isn't visible to use.

I am running Cordova CLI v5.0.0 although the app was made about a year ago so was developed in an older version of Cordova.

Can anyone suggest the best ways to debug this app to find the cause of the problem & why the problem only persists when I run the emulate command but seems fine in the browser?

-- update -- I have installed the Samsung drivers to allow me to connect my OnePlusOne device to adb, and I am know using the Android Studio program to collate errors etc..

In Android studio I can see the logs (see gist below):

https://gist.github.com/gkimpson/fbde0f5a7d1017daae17

Its quite long so added it externally - any ideas why I am having problems with my app?

-- update -- This line seems to be the problem

D/SystemWebChromeClient﹕ file:///android_asset/www/js/app/modules/stickers/stickers.js: Line 357 : Uncaught TypeError: window.requestFileSystem is not a function

The code in stickers.js is below for that section..

if (window.isDevice) {
     window.requestFileSystem(window.PERSISTENT, 512, onInitFs, errorHandler);
} else {
     callback(fc);
}

Solution

  • Ok here is what I had to do when I migrated from cordova 3.6 to cordova 5.

    But first, I suggest you a little reading :

    Cordova Android 4 release notes

    Plugins switch to npm

    The white list plugin documentation And in addition the CSP documentation

    To sum-up, the security has changed in cordova, if you don't add the white list plugin your app will have no network access, and the plugins are now installed via npm instead of via git.

    So what I did (a little bit hardcore maybe):

    • delete completly the platforms/android folder
    • delete the plugins folder (maybe before cordova plugins list if you don't have the list somewhere)
    • reinstall the plugins with the new name (most of external plugins haven't changed name, but all cordova plugins have) for example cordova-plugin-camera replaces org.apache.cordova.camera
    • add the white list plugin and configure it (or if you're not concerned about security, install the white list-legacy plugin which should work as previous versions)
    • add the android platform

    and you can run cordova plugin save and cordova platform saveto have all your plugins and platforms saved in config.xml