MobileChromeApps / cordova-plugin-zip

Zip plugin for Cordova apps
Other
168 stars 206 forks source link

Broken zip crash app (Android,Ionic3) #74

Open klochko7 opened 7 years ago

klochko7 commented 7 years ago

Hi all ! Could someone suggest please .. is it possible to check zip file on valid before unzip ? When zip file not valid .. I do not get into the error that I can catch ...

  this.zip.unzip(this.filePath, this.modelsPath + '/' + model_ext_id, (progress) => {
          this.unzippingSize = Math.round(((progress.loaded / progress.total) * 100));
        }).then((result) => {
          if (result === 0) console.log('SUCCESS');
          if (result === -1) console.log('FAILED');
        });
      }
fuubi commented 7 years ago

Hi, I ran into the same issue. You can read the plugin logs by using the Android Debug Bridge.

  1. Connect to the adb shell
  2. Run logcat | grep Zip

`▶ adb shell

generic_x86:/ $ logcat | grep Zip

09-07 09:32:13.839 4691 4779 E Zip : An error occurred while unzipping.

09-07 09:32:13.839 4691 4779 E Zip : java.io.IOException: Invalid file path

09-07 09:32:13.839 4691 4779 E Zip : at java.io.File.createNewFile(File.java:998)

09-07 09:32:13.839 4691 4779 E Zip : at org.apache.cordova.Zip.unzipSync(Zip.java:130)

09-07 09:32:13.839 4691 4779 E Zip : at org.apache.cordova.Zip.access$000(Zip.java:23)

09-07 09:32:13.839 4691 4779 E Zip : at org.apache.cordova.Zip$1.run(Zip.java:39)

09-07 09:32:13.839 4691 4779 E Zip : at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)

09-07 09:32:13.839 4691 4779 E Zip : at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)

09-07 09:32:13.839 4691 4779 E Zip : at java.lang.Thread.run(Thread.java:764)

09-07 09:32:13.842 4691 4691 D SystemWebChromeClient: http://10.218.4.34:8100/__ion-dev-server/ion-dev.js?v=1.3.12: Line 156 : Error in Error callbackId: Zip105588459 : Unzip faild`