The issue:
I am facing this issue since I have updated from PhoneGap 3.0.0 to 3.1.0.
11-08 15:30:54.997: E/CordovaWebView(32728): CordovaWebView: TIMEOUT ERROR!
The Code
I have the following code in my main Java:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Splash screen
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl(Config.getStartUrl(), 10000);
mContext = getApplicationContext();
appView.addJavascriptInterface(new JSInterface(), "JSPlugin");
}
Relevant part of Config.xml:
<preference name="show-splash-screen-spinner" value="false" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="splashscreen" value="splash" />
<preference name="splashScreenDelay" value="5000" />
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />
</feature>
Index.html (onDeviceReady
runs fine, but hide() doesn't make any difference):
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
navigator.splashscreen.hide();
}
What happens is the following:
The app loads and the splashscreen displays but it doesn't hide. So after a while I get the CordovaWebView: TIMEOUT ERROR!
and the app crashes.
On the screen I get an error:
Application Error
The connection to the server was unsuccessful.
(javascript:JSPlugin.myFunction('...');)
It crashes on both Android 4.2
and Android 4.3
but it runs fine on iOS 6
and iOS 7
.
What I have tried is:
- Cordova update
npm install -g cordova
- Platform update:
cordova platform update android
- Removing and adding Splashscreen plugin again
cordova plugin remove org.apache.cordova.splashscreen
andcordova plugin add org.apache.cordova.splashscreen
. Also tried the same with phonegapphonegap local plugin...
After plugin re-install:
cordova build android
I tried to remove this line
super.setIntegerProperty("splashscreen", R.drawable.splash);
from the main .java because i have theConfig.xml
preference<preference name="splashscreen" value="splash" />
. Still crashes.Removing Splashscreen: if I completely remove the splashscreen preference from
Config.xml
the app loads but obviously without the splashscreen.I have tried this as well: phonegap 3.1 - Unable to hide splash screen on device ready