react-native-google-fit: Task :react-native-google-fit:compileDebugJavaWithJavac FAILED
I upgraded to 0.16.1 and now while I’m trying to run the project but I’m getting those issues:
/Users/***/node_modules/react-native-google-fit/android/src/main/java/com/reactnative/googlefit/SleepHistory.java:78: error: cannot find symbol
.read(DataType.TYPE_SLEEP_SEGMENT)
^
symbol: variable TYPE_SLEEP_SEGMENT
location: class DataType
/Users/***/node_modules/react-native-google-fit/android/src/main/java/com/reactnative/googlefit/SleepHistory.java:77: error: cannot find symbol
.includeSleepSessions()
^
symbol: method includeSleepSessions()
location: class Builder
/Users/***/node_modules/react-native-google-fit/android/src/main/java/com/reactnative/googlefit/SleepHistory.java:84: error: cannot find symbol
.addDataType(DataType.TYPE_SLEEP_SEGMENT, FitnessOptions.ACCESS_READ)
^
symbol: variable TYPE_SLEEP_SEGMENT
location: class DataType
/Users/***/node_modules/react-native-google-fit/android/src/main/java/com/reactnative/googlefit/SleepHistory.java:134: error: cannot find symbol
sleepStage.putInt("sleepStage", dp.getValue(Field.FIELD_SLEEP_SEGMENT_TYPE).asInt());
^
symbol: variable FIELD_SLEEP_SEGMENT_TYPE
location: class Field
/Users/***/node_modules/react-native-google-fit/android/src/main/java/com/reactnative/googlefit/SleepHistory.java:148: error: cannot find symbol
.setDataType(DataType.TYPE_SLEEP_SEGMENT)
^
symbol: variable TYPE_SLEEP_SEGMENT
location: class DataType
/Users/***/node_modules/react-native-google-fit/android/src/main/java/com/reactnative/googlefit/SleepHistory.java:162: error: cannot find symbol
.setField(Field.FIELD_SLEEP_SEGMENT_TYPE, stage.getInt("sleepStage"))
^
symbol: variable FIELD_SLEEP_SEGMENT_TYPE
location: class Field
/Users/***/node_modules/react-native-google-fit/android/src/main/java/com/reactnative/googlefit/SleepHistory.java:170: error: cannot find symbol
.addDataType(DataType.TYPE_SLEEP_SEGMENT, FitnessOptions.ACCESS_WRITE)
^
symbol: variable TYPE_SLEEP_SEGMENT
location: class DataType
/Users/***/node_modules/react-native-google-fit/android/src/main/java/com/reactnative/googlefit/SleepHistory.java:169: error: cannot find symbol
.accessSleepSessions(FitnessOptions.ACCESS_WRITE)
^
symbol: method accessSleepSessions(int)
location: class Builder
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
8 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-google-fit:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
I’ve already cleaned build, Gradle, node_modules and don’t know what to do next
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (2 by maintainers)
Fixed by add
to
android/build.gradleIt seems like you all have some own configurations. Notice that if you want to upgrade something please try to read through the commits. I remember the
set fitness versionis a “temporary” hot fix when googlefit decided to drop some deprecated codes🤔. And you shouldn’t upgrade packages if it works fine since the version is fixed. Google fit will further drop some deprecated codes based on its recent updates.The new functionalities introduced some new types that are not available from old fitness version. So your fitness version might want to match specific package version that you are using currently.
It’s obvious that we can write some code to make version compatibility, but then the codebase will be a mess. Idk
@StasDoskalenko I faced with the same error but I didn’t hardcode google fit version in by app/buildGradle file. Adding
rootProject.ext.set("authVersion", "18.0.0") rootProject.ext.set("fitnessVersion", "20.0.0")helped meI resolved the compiling issue by removing fitnessVersion = “18.0.0” But I m facing a crash when trying to get steps I’m using react-native 0.63 and react-native-google-fit 0.16.1