问题
I am trying to define a new android.tablet skin. I am testing with a Nexus 7 running KitKat.
I did this:
- Added the Skin
- updated
getSkinName()
function - I can see in LogCat the function
getSkinName()
being called
However, there is a confusing message:
"default" skin will be used, because skin named android.tablet was not found. Add a skin or change android/js/skinLoader.js to return existing skin.
Am I missing something?
04-01 17:03:32.969: D/CordovaNetworkManager(4481): Connection Type: wifi 04-01 17:03:32.969: D/CordovaActivity(4481): onMessage(networkconnection,wifi) 04-01 17:03:32.969: D/CordovaLog(4481): file:///android_asset/www/default/js/skinLoader.js: Line 18 : screen.width 800 04-01 17:03:32.969: I/chromium(4481): [INFO:CONSOLE(18)] " screen.width 800", source: file:///android_asset/www/default/js/skinLoader.js (18) 04-01 17:03:32.969: D/CordovaLog(4481): file:///android_asset/www/default/js/skinLoader.js: Line 23 : returned skinName is android.tablet 04-01 17:03:32.969: I/chromium(4481): [INFO:CONSOLE(23)] " returned skinName is android.tablet", source: file:///android_asset/www/default/js/skinLoader.js (23) 04-01 17:03:32.969: W/WLDroidGap(4481): "default" skin will be used, because skin named android.tablet was not found. Add a skin or change android/js/skinLoader.js to return existing skin. ... ... ... 04-01 17:03:34.779: D/CordovaLog(4481): file:///android_asset/www/default/worklight/cordova.js: Line 1034 : processMessage failed: Error: ReferenceError: getSkinName is not defined
回答1:
Looks like you're right, Worklight Skins fail to load - at least on the first load of the application; if you load it a second time, it does work.
I've opened a defect for this issue.
If you are an IBM business partner or customer, please open a PMR so that once fixed you'll be able to receive this in the form of an iFix release.
Here's what I've done:
- Created a new project and application
- Added the Android environment
- Added an application skin, android.skin, to the Android environment
- Added a
main.css
to my-app\android.skin\css withbody {background-color:red}
- Changed
getSkinName()
in my-app\android\js\skinLoader.js' toreturn "android.skin"
- Run As > Run on Worklight Development Server
- Run As > Android application
The first load indeed loads the "default" skin instead of "android.skin". The second time I loaded the app (from the device, not by re-installing the app), it did load the "android.skin"...
So anyway, there's a defect. But you can continue developing your application albeit in a somewhat inconvenient way...
来源:https://stackoverflow.com/questions/22797125/ibm-worklight-getskinname-is-not-defined