{"id":4073,"date":"2014-03-30T07:27:14","date_gmt":"2014-03-30T07:27:14","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/phonegap-3-1-splashscreen-on-android-4-2-4-3-cordovawebview-timeout-error-collection-of-common-programming-errors\/"},"modified":"2014-03-30T07:27:14","modified_gmt":"2014-03-30T07:27:14","slug":"phonegap-3-1-splashscreen-on-android-4-2-4-3-cordovawebview-timeout-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/phonegap-3-1-splashscreen-on-android-4-2-4-3-cordovawebview-timeout-error-collection-of-common-programming-errors\/","title":{"rendered":"PhoneGap 3.1 Splashscreen on Android (4.2, 4.3): CordovaWebView: TIMEOUT ERROR-Collection of common programming errors"},"content":{"rendered":"<p>I am facing this issue since I have updated from PhoneGap 3.0.0 to 3.1.0.<\/p>\n<pre><code>11-08 15:30:54.997: E\/CordovaWebView(32728): CordovaWebView: TIMEOUT ERROR!\n<\/code><\/pre>\n<h2>The Code<\/h2>\n<p>I have the following code in my <strong>main Java<\/strong>:<\/p>\n<pre><code>public void onCreate(Bundle savedInstanceState)\n{\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.main);\n\n    \/\/ Splash screen\n    super.setIntegerProperty(\"splashscreen\", R.drawable.splash);\n\n    super.loadUrl(Config.getStartUrl(), 10000);\n\n    mContext = getApplicationContext();\n    appView.addJavascriptInterface(new JSInterface(), \"JSPlugin\");\n}\n<\/code><\/pre>\n<p>Relevant part of <strong>Config.xml<\/strong>:<\/p>\n<pre><code>\n\n\n\n\n    \n\n<\/code><\/pre>\n<p><strong>Index.html<\/strong> (<code>onDeviceReady<\/code> runs fine, but hide() doesn&#8217;t make any difference):<\/p>\n<pre><code>document.addEventListener(\"deviceready\", onDeviceReady, false);\nfunction onDeviceReady() {\n    navigator.splashscreen.hide();\n}\n<\/code><\/pre>\n<h2>What happens is the following:<\/h2>\n<p>The app loads and the <em>splashscreen<\/em> displays but it doesn&#8217;t hide. So after a while I get the <code>CordovaWebView: TIMEOUT ERROR!<\/code> and the app crashes.<br \/>\nOn the screen I get an error:<\/p>\n<pre><code>Application Error\nThe connection to the server was unsuccessful.\n(javascript:JSPlugin.myFunction('...');)\n<\/code><\/pre>\n<p>It crashes on both <code>Android 4.2<\/code> and <code>Android 4.3<\/code> but it runs fine on <code>iOS 6<\/code> and <code>iOS 7<\/code>.<\/p>\n<h2>What I have tried is:<\/h2>\n<ul>\n<li>Cordova update <code>npm install -g cordova<\/code><\/li>\n<li>Platform update: <code>cordova platform update android<\/code><\/li>\n<li>Removing and adding Splashscreen plugin again <code>cordova plugin remove org.apache.cordova.splashscreen<\/code> and <code>cordova plugin add org.apache.cordova.splashscreen<\/code>. Also tried the same with phonegap <code>phonegap local plugin...<\/code><\/li>\n<li>\n<p>After plugin re-install: <code>cordova build android<\/code><\/p>\n<\/li>\n<li>\n<p>I tried to remove this line <code>super.setIntegerProperty(\"splashscreen\", R.drawable.splash);<\/code> from the <strong>main .java<\/strong> because i have the <code>Config.xml<\/code> preference . Still crashes.<\/p>\n<\/li>\n<li>\n<p><strong>Removing Splashscreen<\/strong>: if I completely remove the splashscreen preference from <code>Config.xml<\/code> the app loads but obviously without the splashscreen.<\/p>\n<\/li>\n<li>\n<p>I have tried this as well: phonegap 3.1 &#8211; Unable to hide splash screen on device ready<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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(&#8220;splashscreen&#8221;, R.drawable.splash); super.loadUrl(Config.getStartUrl(), 10000); mContext = getApplicationContext(); appView.addJavascriptInterface(new JSInterface(), &#8220;JSPlugin&#8221;); } Relevant part of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4073","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4073"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4073\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}