安装
sudo npm install -g cordova
cordova create AppName
cordova platform add browser
cordova run browser
cordova platform add android –save
cordova platform ls
cordova requirements
编译
cordova build android
cordova build android -release
cordova emulate android
配置XML
vi config.xml
签名
keytool -genkey -v -keystore release-key.keystore -alias cordova-demo -keyalg RSA -keysize 2048 -validity 10000
vi build.json
1 2 3 4 5 6 7 8 9 10
| { "android": { "release": { "keystore": "release-key.keystore", "alias": "cordova-demo", "storePassword": "password", "password": "password" } } }
|
禁用缓存
1 2 3 4 5 6 7 8 9 10 11 12
| import android.webkit.WebSettings; import android.webkit.WebView; @Override protected void onResume() { super.onResume(); // Disable caching .. WebView wv = (WebView) appView.getEngine().getView(); WebSettings ws = wv.getSettings(); ws.setAppCacheEnabled(false); ws.setCacheMode(WebSettings.LOAD_NO_CACHE); loadUrl(launchUrl); // launchUrl is the default url specified in Config.xml }
|