Reputation: 1
This is the code I have for trying to instantiate it:
private synchronized void callConnection(){
mGoogleApiClient = new GoogleApiClient().Builder
.addOnConnectionFailedListener(this)
.addConnectionCallbacks(this)
.addApi(LocationServices.API)
.build();
mGoogleApiClient.connect();
This is what I have in my build.gradle:
compile 'com.google.android.gms:play-services:6.5.87'
I get this error:
Error:(222, 28) error: GoogleApiClient is abstract; cannot be instantiated
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
>Compilation failed; see the compiler error output for details.
Upvotes: 0
Views: 888
Reputation: 37404
It's a builder pattern so you need to instantiate Builder
( static inner class) object which is responsible to construct the underlying object with the defined operations (invoked methods) so use
new GoogleApiClient.Builder()
instead of
new GoogleApiClient().Builder
Upvotes: 5