OvalMoney / react-native-fitness

A React Native module to interact with Apple Healthkit and Google Fit.
MIT License
343 stars 68 forks source link

error: cannot find symbol: variable TYPE_ACTIVITY_SAMPLES #64

Closed laxminarayanmn closed 4 years ago

laxminarayanmn commented 4 years ago
Screenshot 2020-08-11 at 10 20 51 PM

node_modules/@ovalmoney/react-native-fitness/android/src/main/java/com/ovalmoney/fitness/manager/Manager.java:145: error: cannot find symbol .subscribe(DataType.TYPE_ACTIVITY_SAMPLES) ^ symbol: variable TYPE_ACTIVITY_SAMPLES location: class DataType

It was working fine, suddenly stopped working today after npm install for other library

react-native 0.62.0 @ovalmoney/react-native-fitness: 0.4.0

Francesco-Voto commented 4 years ago

Hi @laxminarayanmn , have you change the version of :play-services-fitness ?

laxminarayanmn commented 4 years ago

yes, Im using googlePlayServicesVersion = "+" // default: " in projects gradle

'com.google.android.gms:play-services-fitness:19.0.0' in app gradle

Francesco-Voto commented 4 years ago

It seems it does not exist anymore. I will fix it

Francesco-Voto commented 4 years ago

Can you use 17.0.0 for the moment?

laxminarayanmn commented 4 years ago

sure, i'll use the 17.0.0

auliakbarh commented 4 years ago

@laxminarayanmn does it works if you use 'com.google.android.gms:play-services-fitness:17.0.0' in app gradle?

I comment these code: Fitness.getRecordingClient(context, account) .subscribe(DataType.TYPE_ACTIVITY_SAMPLES) .addOnSuccessListener(new OnSuccessListener() { @Override public void onSuccess(Void aVoid) { promise.resolve(true); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { promise.resolve(false); } });

in [PROJECT_PATH]/node_modules/@ovalmoney/react-native-fitness/android/src/main/java/com/ovalmoney/fitness/manager/Manager.java

laxminarayanmn commented 4 years ago

@auliakbarh it worked as expected when i removed googlePlayServicesVersion = "+"from projects gradle

francisli commented 4 years ago

I could use some help from anyone on this thread... my project did not have neither a dependency implementation line nor a googlePlayServicesVersion line in its build.gradle... I've tried adding them and specifying version 17.0.0, but it does not solve the compilation issue...

What has happened in just the last week or so?

francisli commented 4 years ago

Ok, I see the removal of the field in the release notes:

https://developers.google.com/android/guides/releases#august_10_2020

francisli commented 4 years ago

Ok, I see how the build.gradle for this library is written now... for anyone else visiting this thread, you can specify an older version of Google Play Services in your top-level build.gradle file, for example:

buildscript {
    ext {
        ...
        googlePlayServicesVersion = '17.0.0'
    }
}

When I tried bumping down just to 18.0.0 I got an error that iid services could not be found with that version...