I'm attempting to use the OkHttp-Xamarin library in a Xamarin Android application. Whenever I try to create a new OkHttpNetworkHandler I get the exception below.
Line:
var handler = new OkHttpNetworkHandler();
Throws:
[] Missing method Android.Runtime.JNIEnv::AllocObject(Type) in assembly Mono.Android.dll, referenced in assembly /data/data/com.my.app/files/.__override__/OkHttp.dll
[MonoDroid] UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.AllocObject'.
[MonoDroid] at ModernHttpClient.OkHttpNetworkHandler..ctor () <IL 0x00001, 0x00057>
I am using prebuilt binaries from ModernHttpClient version 0.9. My minimum Android version is set to 2.3 and target is set to 4.2. I'm using Xamarin Studio 4.0.13 and Mono 3.2.3.
So this looks like the first call to your binding code.
A couple things could be going on here:
EmbeddedJar instead of InputJar as the build action for the jar file. Otherwise, you have to include the jar with your main Android application.If neither of those fix your issue, let me know, I think there is a working binding Paul Betts has for this library.
Not really an answer to why the Exception is being thrown but at the suggestion of Paul Betts I switched to the Alpha channel and things are working now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With