OSCache was not initialized because Cordova was not loaded. - Mobile

OSCache was not initialized because Cordova was not loaded. - Mobile

  

Hello,

I'm getting an error when using Mobile functionality from P10.

When I install the .apk in an android device I keep getting this error:


Tenant:
Users
User:

Session Id:
No session
Server:
MSTVEDPD-1
Module:
ResourceCache
Message:


OSCache was not initialized because Cordova was not loaded.
Running on native but cordova wasn't loaded



I searched in forums and found some similar issues, however neither of them helped me.

Any one knows what could be the cause of this?


Hi Raphael,

Could you tell exactly which functionalities (plugins) are you trying to use?
And this happens with ANY mobile application/plugin or there are specific plugins that does not work?

This is important to us to be able to help you, as there are many different reasons to this kind of error to happen.

If you can provide a minimal application (oml) without business logic that have the same problem, would be nice.

Cheers,
Eduardo Jauch

Hello Eduardo,


The problem occurs when I try to open the .apk, I can't initialize the app. 

It is not a single fuctionality.

Seems like is happening with all Applications.

I will try to provide an oml, but you know what are the most commom causes?


Thanks,

RR

Raphael Ranieri wrote:

Hello Eduardo,


The problem occurs when I try to open the .apk, I can't initialize the app. 

It is not a single fuctionality.

Seems like is happening with all Applications.

I will try to provide an oml, but you know what are the most commom causes?


Thanks,

RR

You mean, when you try to OPEN the application or when you try to INSTALL the package?
Also, what's the the version of the platform where you are creating the native package?
Have you tried to do a simple mobile application in your personal, and the same in the environment where you are working?
Have you tried to install a mobile application from forge, generated the package and install/run in your mobile to see if it works?
Did you tried to install the packages you are installing in another different mobile?

Cheers,
Eduardo Jauch

Hey Eduardo,

Sorry for the very late reply.

I was able to workaround the problem, however, I sort of still having it.

Now every first time I open the android app in my cellphone I get the Following screen:


In Service Center I have the following error:

Time of Log:
05-12-2017 19:21:50
eSpace:
Mobile
Tenant:
Users
User:
(40222)
Session Id:
No session
Module:
ResourceCache
Message:
OSCache was not initialized because Cordova was not loaded.
Running on native but cordova wasn't loaded
Environment Information
eSpaceVer: 151 (Id=21902, PubId=21851, CompiledWith=10.0.302.0)
RequestUrl: https://outsystems.../Mobile/moduleservices/log?1512501710447 (Method: POST)
FilePath: C:\...\PS\running\Mobile.392406641\
Locale: en-US
DateFormat: dd-MM-yyyy
PID: 4196 ('w3wp', Started='17-10-2017 16:35:06', Priv=1309Mb, Virt=19671Mb)
TID: 519
Thread Name: 
.NET: 4.0.30319.42000
Client-Side Log
Stack:
undefined


Followed by another error:

Time of Log:
05-12-2017 19:21:50
eSpace:
Mobile
Tenant:
Users
User:
(40222)
Session Id:
No session
Module:
VersionsManager
Message:
Unable to load the data model
Running on native but cordova wasn't loaded
Environment Information
eSpaceVer: 151 (Id=21902, PubId=21851, CompiledWith=10.0.302.0)
RequestUrl: https://outsystems.../Mobile/moduleservices/log?1512501711870 (Method: POST)
FilePath: C:\...\PS\running\Mobile.392406641\
Locale: en-US
DateFormat: dd-MM-yyyy
PID: 4196 ('w3wp', Started='17-10-2017 16:35:06', Priv=1309Mb, Virt=19670Mb)
TID: 252
Thread Name: 
.NET: 4.0.30319.42000
Client-Side Log
Stack:
undefined


Once I click Reload, the app works normally.

I have no clue why this is happening now.


My env version is:

Development mode
Version 10.0.302.0

It happens on all Devices.

Any help?

Att,

RR

Solution

Hello. I managed to track down the source of this problem. My hostname configuration in Service Center had a slash character at the end:


Here are some notes from my debugging, that might help you even if your error is caused by something else.

I attached to the app with Google Chrome and set it to break on exceptions, even caught ones:


The first error that occurred was this one:

"Error: Unable to access '//moduleservices/moduleinfo'. Error Code: 0
    at XMLHttpRequest.xhr.onerror.xhr.ontimeout (https://server//MyApp/scripts/OutSystemsManifestLoader.js?d2W5ySVk+Gp8rg16OzCehQ:43:71)"

The double slash after the hostname on https://server//MyApp/ was very suspicious. It turns out that the mobile app was starting with a URL that contained two slashes after the hostname, and not one. Inside the OutSystemsManifestLoader.js there is some javascript that tries to build the URL for /MyApp/moduleservices/moduleinfo but it gets confused with the double slash, and ends up building the //moduleservices/moduleinfo. This is a protocol-relative URL which is effectively interpreted as https://moduleservices/moduleinfo, which clearly makes no sense.

After find that out, it was a matter of searching everywhere for a misplaced slash. I was lucky to find it in Service Center, but some other places that occurred to me could cause this would be redirects to dynamic URLs within the app, and SEO rules.

Solution