I would like to use this plugin in my phonegap app to download and cache remote app resources. However, the app crashes when it starts download. I don't know why? Got the latest version from GitHub and trying to build a sample application and it crashes. I'm testing it on Android device. Cordova version is 6.1.1.. Any help is much appreciated.
JS Code:
function startSync() {
var statusDiv = $("#syncstatus");
var url = "https://static.raymondcamden.com/kittens.zip";
var sync = ContentSync.sync({ src: url, id: 'ccswebresource', type: 'merge', });
sync.on('progress', function (data) {
// statusDiv.innerHTML = "<p>Syncing In progress: " + data.progress + "%</p>";
});
sync.on('complete', function (data) {
console.log(data.localPath);
frameworkFunctions.remoteUrl = data.localPath;
});
sync.on('error', function (e) {
console.log('Error: ', e.message);
alert(e.message);
});
}
Crash logs..
05-09 16:23:33.510: D/ContentSync(10380): download https://static.raymondcamden.com/kittens.zip
05-09 16:23:33.510: D/ContentSync(10380): Download file: https://static.raymondcamden.com/kittens.zip
05-09 16:23:33.510: D/ContentSync(10380): Target file: /data/data/com.ccs/cache/cdv_ccswebresource-1593078096.tmp
05-09 16:23:33.510: D/ContentSync(10380): size = 0
05-09 16:23:33.620: W/dalvikvm(10380): threadid=14: thread exiting with uncaught exception (group=0x416fec08)
05-09 16:23:33.620: E/AndroidRuntime(10380): FATAL EXCEPTION: pool-1-thread-1
05-09 16:23:33.620: E/AndroidRuntime(10380): Process: com.ccs, PID: 10380
05-09 16:23:33.620: E/AndroidRuntime(10380): java.lang.NullPointerException
05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:632)
05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347)
05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503)
05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:136)
05-09 16:23:33.620: E/AndroidRuntime(10380): at com.adobe.phonegap.contentsync.Sync.download(Sync.java:367)
05-09 16:23:33.620: E/AndroidRuntime(10380): at com.adobe.phonegap.contentsync.Sync.access$100(Sync.java:70)
05-09 16:23:33.620: E/AndroidRuntime(10380): at com.adobe.phonegap.contentsync.Sync$4.run(Sync.java:488)
05-09 16:23:33.620: E/AndroidRuntime(10380): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
05-09 16:23:33.620: E/AndroidRuntime(10380): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
05-09 16:23:33.620: E/AndroidRuntime(10380): at java.lang.Thread.run(Thread.java:841)
Hi,
I would like to use this plugin in my phonegap app to download and cache remote app resources. However, the app crashes when it starts download. I don't know why? Got the latest version from GitHub and trying to build a sample application and it crashes. I'm testing it on Android device. Cordova version is 6.1.1.. Any help is much appreciated.
JS Code:
function startSync() {
Crash logs..
05-09 16:23:33.510: D/ContentSync(10380): download https://static.raymondcamden.com/kittens.zip 05-09 16:23:33.510: D/ContentSync(10380): Download file: https://static.raymondcamden.com/kittens.zip 05-09 16:23:33.510: D/ContentSync(10380): Target file: /data/data/com.ccs/cache/cdv_ccswebresource-1593078096.tmp 05-09 16:23:33.510: D/ContentSync(10380): size = 0 05-09 16:23:33.620: W/dalvikvm(10380): threadid=14: thread exiting with uncaught exception (group=0x416fec08) 05-09 16:23:33.620: E/AndroidRuntime(10380): FATAL EXCEPTION: pool-1-thread-1 05-09 16:23:33.620: E/AndroidRuntime(10380): Process: com.ccs, PID: 10380 05-09 16:23:33.620: E/AndroidRuntime(10380): java.lang.NullPointerException 05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:632) 05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347) 05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296) 05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:503) 05-09 16:23:33.620: E/AndroidRuntime(10380): at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:136) 05-09 16:23:33.620: E/AndroidRuntime(10380): at com.adobe.phonegap.contentsync.Sync.download(Sync.java:367) 05-09 16:23:33.620: E/AndroidRuntime(10380): at com.adobe.phonegap.contentsync.Sync.access$100(Sync.java:70) 05-09 16:23:33.620: E/AndroidRuntime(10380): at com.adobe.phonegap.contentsync.Sync$4.run(Sync.java:488) 05-09 16:23:33.620: E/AndroidRuntime(10380): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 05-09 16:23:33.620: E/AndroidRuntime(10380): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 05-09 16:23:33.620: E/AndroidRuntime(10380): at java.lang.Thread.run(Thread.java:841)