Skip to content

Instantly share code, notes, and snippets.

@willrax
Created January 6, 2015 00:55
Show Gist options
  • Select an option

  • Save willrax/d4b666c56c83455f19d6 to your computer and use it in GitHub Desktop.

Select an option

Save willrax/d4b666c56c83455f19d6 to your computer and use it in GitHub Desktop.
def setup_google_services
@google_client = Com::Google::Android::Gms::Common::Api::GoogleApiClient::Builder.new(self)
@google_client.addConnectionCallbacks(self)
@google_client.addApi(Com::Google::Android::Gms::Location::LocationServices::API)
end
>> E/com/willrax/weather( 4087): Java exception raised: java.lang.NullPointerException:
Attempt to invoke virtual method 'java.util.List com.google.android.gms.common.api.Api.gy()' on a null object reference
--------- beginning of crash
E/AndroidRuntime( 4087): FATAL EXCEPTION: main
E/AndroidRuntime( 4087): Process: com.willrax.weather, PID: 4087
E/AndroidRuntime( 4087): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.willrax.weather/com.willrax.weather.MainActivity}:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.google.android.gms.common.api.Api.gy()' on a null object reference
@willrax
Copy link
Author

willrax commented Jan 6, 2015

This is only failing when i try to add the api.

@lrz
Copy link

lrz commented Jan 6, 2015

Could you run adb -d logcat in a separate terminal and paste the full crash report?

@willrax
Copy link
Author

willrax commented Jan 6, 2015

@lrz
Copy link

lrz commented Jan 6, 2015

Could it be that the argument passed to addApi() is nil?

@willrax
Copy link
Author

willrax commented Jan 6, 2015

Quite possible, it is a nullobject error. Doing a puts on the object outputs nothing.

@willrax
Copy link
Author

willrax commented Jan 6, 2015

LocationServices::API is supposed to be a constant, so im guessing it should be returning something. Though it doesn't return anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment