Android中的Xamarin ModernHttpClient异常

时间:2015-05-05 18:19:59

标签: c# android http xamarin mvvmcross

我使用该插件已经有一段时间了,我从来没有遇到任何问题,但在我的新项目中,由于某些原因,ModernHttpClient的OkHttp库无法正常工作。

每个Http请求都会引发异常:

12-10 18:13:20.527 W/        ( 4373): Missing method Android.Runtime.JNIEnv::CallStaticObjectMethod(intptr,intptr,JValue*) in assembly Mono.Android.dll, referenced in assembly OkHttp.dll
mvx:Diagnostic: 17.36 Exception occurred in request: System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.CallStaticObjectMethod'.
12-10 18:13:20.537 I/mono-stdout( 4373): mvx:Diagnostic: 17.36 Exception occurred in request: System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.CallStaticObjectMethod'.

  at ModernHttpClient.NativeMessageHandler+<SendAsync>c__async0.MoveNext () [0x00138] in /Users/paul/code/paulcbetts/modernhttpclient/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs:93 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
12-10 18:13:20.537 I/mono-stdout( 4373):   at ModernHttpClient.NativeMessageHandler+<SendAsync>c__async0.MoveNext () [0x00138] in /Users/paul/code/paulcbetts/modernhttpclient/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs:93 
[0:] mvx:Diagnostic: 17.36 Exception occurred in request: System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.CallStaticObjectMethod'.
  at ModernHttpClient.NativeMessageHandler+<SendAsync>c__async0.MoveNext () [0x00138] in /Users/paul/code/paulcbetts/modernhttpclient/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs:93 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0 
  at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown --

我做错了什么?有办法解决吗?

0 个答案:

没有答案