Cannot initialize LocationClient

felipeleusinfelipeleusin USMember, Beta

After a while I finally got Google Play Services working with Xamarin but the Map demo just includes, well, maps. After some messing around I got the Location classes (and fairly new to Java Binding) but I can`t use them.

Whenever I try to instantiate a LocationClient I get the following error:

Java.Lang.NullPointerException: null reference
at Android.Runtime.JNIEnv.NewObject (intptr,intptr,Android.Runtime.JValue[]) [0x00030] in /Users/builder/data/lanes/monodroid-lion-bs1/95789e18/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:464
at Android.Gms.Location.LocationClient..ctor (Android.Content.Context,Android.Gms.Common.IGooglePlayServicesClientConnectionCallbacks,Android.Gms.Common.IGooglePlayServicesClientOnConnectionFailedListener) [0x000b8] in /Users/felipeamorim/Projects/igarape/SmartPolicing.Xamarin/GooglePlayServices/obj/Debug/generated/src/Android.Gms.Location.LocationClient.cs:362
at SmartPolicing.Xamarin.Activity1.OnCreate (Android.OS.Bundle) [0x0007e] in /Users/felipeamorim/Projects/igarape/SmartPolicing.Xamarin/SmartPolicing.Xamarin/MainActivity.cs:46
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-lion-bs1/95789e18/source/monodroid/src/Mono.Android/platforms/android-17/src/generated/Android.App.Activity.cs:2027
at at (wrapper dynamic-method) object.9ffe53c2-e74f-4936-a2bc-ef783e3a4f08 (intptr,intptr,intptr)
at
at --- End of managed exception stack trace ---
at java.lang.NullPointerException: null reference
at at com.google.android.gms.internal.x.d(Unknown Source)
at at com.google.android.gms.internal.p.(Unknown Source)
at at com.google.android.gms.internal.ce.(Unknown Source)
at at com.google.android.gms.location.LocationClient.(Unknown Source)
at at smartpolicing.xamarin.Activity1.n_onCreate(Native Method)
at at smartpolicing.xamarin.Activity1.onCreate(Activity1.java:30)
at at android.app.Activity.performCreate(Activity.java:5104)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2357)
at at android.app.ActivityThread.access$600(ActivityThread.java:153)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at at android.os.Handler.dispatchMessage(Handler.java:99)
at at android.os.Looper.loop(Looper.java:137)
at at android.app.ActivityThread.main(ActivityThread.java:5226)
at at java.lang.reflect.Method.invokeNative(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:511)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
at at dalvik.system.NativeStart.main(Native Method)
at

Anyone got some pointers? My metadata.xml looks like this:





<attr path="/api/package[@name='com.google.android.gms.maps']" name="managedName">Android.Gms.Maps</attr>
<attr path="/api/package[@name='com.google.android.gms.maps.model']" name="managedName">Android.Gms.Maps.Model</attr>
<attr path="/api/package[@name='com.google.android.gms.common']" name="managedName">Android.Gms.Common</attr>  
<attr path="/api/package[@name='com.google.android.gms.location']" name="managedName">Android.Gms.Location</attr>

<attr path="/api/package[@name='com.google.android.gms.maps.model']/class[@name='MarkerOptions']/method[@name='position']" name="managedName">SetPosition</attr>
<attr path="/api/package[@name='com.google.android.gms.maps.model']/class[@name='MarkerOptions']/method[@name='snippet']" name="managedName">SetSnippet</attr>
<attr path="/api/package[@name='com.google.android.gms.maps.model']/class[@name='MarkerOptions']/method[@name='title']" name="managedName">SetTitle</attr>

I think I might be forgetting something here but don`t know what

Posts

  • YeTianYeTian USMember ✭✭

    Hi. I'm getting the same error as you did. Did you resolve it?

Sign In or Register to comment.