升级到Google Play Services 7.0 后,我的连接 Google Fit 的
GoogleApiClient
代码不再起作用,出现以下错误:
我建立Error:(87, 21) error: no suitable method found for addApi(Void) method Builder.addApi(Api,O) is not applicable (cannot instantiate from arguments because actual and formal argument lists differ in length) method Builder.addApi(Api) is not applicable (actual argument Void cannot be converted to Api by method invocation conversion) where O is a type-variable: O extends HasOptions declared in method addApi(Api,O)
GoogleApiClient
的代码如下:mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Fitness.API)
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();