I’ve just received the PhoneGap solution from by sub-contractor in order to test it on my phone before launch.
I import the project into Eclipse and it all looks fine.
I can test the app locally on my computer by opening the index.html file:
file://E:/AppDevelopment/Workspace/myproject/assets/www/index.html
So far so good. Then I try launching this an my phone ( via USB cabel). The front page opens, but the CSS is missing. And when I click any link, I get the following message:
"A network error occurred. (file:///android_asset/www/car.html?carID=106"
Has anyone had similar problems? Any suggestions to how I can debug what is wrong?
UPDATE
Following Dmyto’s suggestion, I’m trying to change the onReceivedError. But I only get coding errirs.
package com.phonegap.mysite;
import android.os.Bundle;
import org.apache.cordova.*;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class Mysiteextends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
/** This is where it goes wrong **/
WebView webview = new WebView(this);
webview.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.i("WEB_VIEW_TEST", "error code:" + errorCode);
super.onReceivedError(view, errorCode, description, failingUrl);
}
}
Without seeing your
index.htmlcode it is hard to tell if you are referencing your css files properly. Also, that url:file:///android_asset/www/car.html=carID=106doesn’t seem valid? What is with the=carID=106? A proper URL should be?carID=106. But wait there’s more, there is a bug on Android where url paramters are not read properly.It’s a bug on Android. You should go star it:
In the meantime use
localStorage.setItem()/getItem()to pass values between pages.