I have tested the UploadFileAsync function in Android 4.4 and it works fine (uploads the file, returns statuscode=200 and correct info in the Message property).
When I run it in Android 8.0 or 9.0, the UploadFileAsync methods, uploads the file but the statuscode returned is -1 and the info in the message property is:
----- error returned -------------------------
Java.Net.ProtocolException: Expected ':status' header not present
at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00068] in <034d4a9852dd45bea9353cc7776c99f0>:0
at Android.Runtime.JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <4d996bab56b14864b2a1299fea73b3fe>:0
at OkHttp.Call.Execute () [0x00049] in :0
at Plugin.FileUploader.FileUploadManager.MakeRequest (System.String url, System.String tag, OkHttp.MultipartBuilder requestBodyBuilder, System.Collections.Generic.IDictionary`2[TKey,TValue] headers) [0x000a2] in C:\Plugins\FileUploader\src\Plugin.FileUploader.Android\FileUploadManager.cs:245
at Plugin.FileUploader.FileUploadManager+<>c__DisplayClass26_0.b__0 () [0x0008d] in C:\Plugins\FileUploader\src\Plugin.FileUploader.Android\FileUploadManager.cs:154
--- End of managed Java.Net.ProtocolException stack trace ---
java.net.ProtocolException: Expected ':status' header not present
at com.squareup.okhttp.internal.http.SpdyTransport.readNameValueBlock(SpdyTransport.java:197)
at com.squareup.okhttp.internal.http.SpdyTransport.readResponseHeaders(SpdyTransport.java:104)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:830)
at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:95)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:823)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:684)
at com.squareup.okhttp.Call.getResponse(Call.java:272)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:228)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:199)
at com.squareup.okhttp.Call.execute(Call.java:79)
Bug Information
Version Number of Plugin: V1.4.0
Device Tested On: Android 8,0 and Android 9.0
Version of VS: Vs2017
Version of Xamarin: 3.1.0.697729
Steps to reproduce the Behavior
var upload1 = await CrossFileUploader.Current.UploadFileAsync(string.Format(service.GetRestURL, "/filepermits"), new Plugin.FileUploader.Abstractions.FilePathItem(pick.FileName, pick.FilePath), new Dictionary<string, string>()
{
{"Authorization","xxxxxxxxxxxxx"},
{"Id",user},
{"Company",company},
{"PermitId",Permits_id}
});
Expected Behavior
Returns:
StatusCode=200
Upload1.Message="Returned info from service"
Actual Behavior
Returns:
StatusCode=-1
Upload1.Message=Java.Net.ProtocolException: Expected ':status' header not present
at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method)
I have tested the UploadFileAsync function in Android 4.4 and it works fine (uploads the file, returns statuscode=200 and correct info in the Message property).
When I run it in Android 8.0 or 9.0, the UploadFileAsync methods, uploads the file but the statuscode returned is -1 and the info in the message property is:
----- error returned -------------------------
Java.Net.ProtocolException: Expected ':status' header not present at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method) [0x00068] in <034d4a9852dd45bea9353cc7776c99f0>:0 at Android.Runtime.JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod) [0x0000e] in <4d996bab56b14864b2a1299fea73b3fe>:0 at OkHttp.Call.Execute () [0x00049] in:0
at Plugin.FileUploader.FileUploadManager.MakeRequest (System.String url, System.String tag, OkHttp.MultipartBuilder requestBodyBuilder, System.Collections.Generic.IDictionary`2[TKey,TValue] headers) [0x000a2] in C:\Plugins\FileUploader\src\Plugin.FileUploader.Android\FileUploadManager.cs:245
at Plugin.FileUploader.FileUploadManager+<>c__DisplayClass26_0.b__0 () [0x0008d] in C:\Plugins\FileUploader\src\Plugin.FileUploader.Android\FileUploadManager.cs:154
--- End of managed Java.Net.ProtocolException stack trace ---
java.net.ProtocolException: Expected ':status' header not present
at com.squareup.okhttp.internal.http.SpdyTransport.readNameValueBlock(SpdyTransport.java:197)
at com.squareup.okhttp.internal.http.SpdyTransport.readResponseHeaders(SpdyTransport.java:104)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:830)
at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:95)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:823)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:684)
at com.squareup.okhttp.Call.getResponse(Call.java:272)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:228)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:199)
at com.squareup.okhttp.Call.execute(Call.java:79)
Bug Information
Version Number of Plugin: V1.4.0 Device Tested On: Android 8,0 and Android 9.0 Version of VS: Vs2017 Version of Xamarin: 3.1.0.697729
Steps to reproduce the Behavior
var upload1 = await CrossFileUploader.Current.UploadFileAsync(string.Format(service.GetRestURL, "/filepermits"), new Plugin.FileUploader.Abstractions.FilePathItem(pick.FileName, pick.FilePath), new Dictionary<string, string>() { {"Authorization","xxxxxxxxxxxxx"}, {"Id",user}, {"Company",company}, {"PermitId",Permits_id} });
Expected Behavior
Returns:
StatusCode=200 Upload1.Message="Returned info from service"
Actual Behavior
Returns:
StatusCode=-1 Upload1.Message=Java.Net.ProtocolException: Expected ':status' header not present at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method)
Thanks for youe help. Armando