2016-12-29 1 views
1

에뮬레이터와 Xamarin studio C# Bt를 사용하여 디렉토리에 zip 파일의 압축을 푸는 중입니다. 여러 가지 방법을 시도했지만이 방법을 시도하지 못했습니다. 어떻게 해결할 수 있습니까? 여기 내 코드가 있습니다. :디렉토리에 zip 파일의 압축을 풉니 다

string zipPath=("/storage/emulated/0/Download/file/file/file.epub"); 
    string extractPath = ("/storage/emulated/0/Download/file/file/temp"); 
    DateTime time = new DateTime(2016, 12, 30); 
    if (File.Exists(extractPath)) 
     File.SetLastWriteTime(extractPath, time); 
    ZipFile.ExtractToDirectory(zipPath, extractPath); 

하지만 난 같은 오류를 얻고있다 :

[MonoDroid] System.IO.IOException: Invalid parameter 
[MonoDroid] at System.IO.File.SetLastWriteTime (System.String path, System.DateTime lastWriteTime) [0x00030] in <500f590720b848ecadaddac3c375ddb5>:0 
[MonoDroid] at AD_Forms.AD..ctor() [0x00061] in <21d9786453cc4650b478317d331d91ab>:0 
[MonoDroid] at AD_Forms.App..ctor() [0x00006] in <21d9786453cc4650b478317d331d91ab>:0 
[MonoDroid] at AD_Forms.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00022] in <21d9786453cc4650b478317d331d91ab>:0 
[MonoDroid] at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <27c17fe440cf491ba8255bcefade6e02>:0 
[MonoDroid] at (wrapper dynamic-method) System.Object:a118a7e9-2106-4f87-a55c-98f583aa9bd8 (intptr,intptr,intptr) 
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable 
[AndroidRuntime] Shutting down VM 
[AndroidRuntime] FATAL EXCEPTION: main 
[AndroidRuntime] Process: com.companyname.ad_forms, PID: 1909 
[AndroidRuntime] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 
[AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
[AndroidRuntime] Caused by: java.lang.reflect.InvocationTargetException 
[AndroidRuntime] at java.lang.reflect.Method.invoke(Native Method) 
[AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
[AndroidRuntime] ... 1 more 
[AndroidRuntime] Caused by: android.runtime.JavaProxyThrowable: System.IO.IOException: Invalid parameter 
[AndroidRuntime] at System.IO.File.SetLastWriteTime (System.String path, System.DateTime lastWriteTime) [0x00030] in <500f590720b848ecadaddac3c375ddb5>:0 
[AndroidRuntime] at AD_Forms.AD..ctor() [0x00061] in <21d9786453cc4650b478317d331d91ab>:0 
[AndroidRuntime] at AD_Forms.App..ctor() [0x00006] in <21d9786453cc4650b478317d331d91ab>:0 
[AndroidRuntime] at AD_Forms.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00022] in <21d9786453cc4650b478317d331d91ab>:0 
[AndroidRuntime] at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <27c17fe440cf491ba8255bcefade6e02>:0 
[AndroidRuntime] at (wrapper dynamic-method) System.Object:a118a7e9-2106-4f87-a55c-98f583aa9bd8 (intptr,intptr,intptr) 
[AndroidRuntime] at md595826e4c93c1bb9112307fcbc37b1beb.MainActivity.n_onCreate(Native Method) 
[AndroidRuntime] at md595826e4c93c1bb9112307fcbc37b1beb.MainActivity.onCreate(MainActivity.java:29) 
[AndroidRuntime] at android.app.Activity.performCreate(Activity.java:6237) 
[AndroidRuntime] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
[AndroidRuntime] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
[AndroidRuntime] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
[AndroidRuntime] at android.app.ActivityThread.-wrap11(ActivityThread.java) 
[AndroidRuntime] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
[AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:102) 
[AndroidRuntime] at android.os.Looper.loop(Looper.java:148) 
[AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:5417) 
+0

해결 했습니까? 나는 똑같은 문제를 겪고있다! – John

답변

0

당신이 매니페스트 파일에 권한을 추가하는 방법은 무엇입니까? 안드로이드의 버그로 인해 수 있습니다

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 

이 버그질라 보고서의 언급 : https://bugzilla.xamarin.com/show_bug.cgi?id=3029

시도는 같은 문제가 있는지 여부를 확인하는 대신 에뮬레이터의 실제 장치에서 코드를 실행합니다.

+0

예 위의 권한을 매니페스트 파일에 추가했습니다. – ShahNawaz

관련 문제