Closed zinaida2mc closed 3 years ago
which react-native version do you use? Do you use react-native link
on this package in the past? I believe this kind of problems always come from your android build gradle setting.
RN version is 0.63
No, I chose manual installation
I was trying to update package since play beta demanding targetSdkVersion starting from 29 and app crashes on getting steps count because of missing permission of activity_recognition
Can you paste your build.grade
setting? I can test it out right now to see if i can reproduce the issue
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: "com.google.firebase.firebase-perf"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
]
rootProject.ext.set("authVersion", "18.0.0")
rootProject.ext.set("fitnessVersion", "18.0.0")
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "app.id"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 63
versionName "1.1.2"
multiDexEnabled true
}
signingConfigs {
debug {
if (project.hasProperty('DEVELOPMENT_KEYSTORE_FILE')) {
storeFile file(DEVELOPMENT_KEYSTORE_FILE)
storePassword DEVELOPMENT_KEYSTORE_PASSWORD
keyAlias DEVELOPMENT_KEY_ALIAS
keyPassword DEVELOPMENT_KEY_PASSWORD
}
}
staging {
if (project.hasProperty('STAGING_KEYSTORE_FILE')) {
storeFile file(STAGING_KEYSTORE_FILE)
storePassword STAGING_KEYSTORE_PASSWORD
keyAlias STAGING_KEY_ALIAS
keyPassword STAGING_KEY_PASSWORD
}
}
release {
if (project.hasProperty('PRODUCTION_KEYSTORE_FILE')) {
storeFile file(PRODUCTION_KEYSTORE_FILE)
storePassword PRODUCTION_KEYSTORE_PASSWORD
keyAlias PRODUCTION_KEY_ALIAS
keyPassword PRODUCTION_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.debug
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
staging {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
matchingFallbacks = ['release']
signingConfig signingConfigs.staging
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-google-fit')
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
I wonder about this one defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion }
I believe it comes from your android/build.grade
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 27
compileSdkVersion = 29
targetSdkVersion = 29
androidXCore = "1.0.2"
}
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
classpath 'com.google.firebase:perf-plugin:1.2.1'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
}
}
allprojects {
repositories {
mavenLocal()
maven {
url("$rootDir/../node_modules/react-native/android")
}
maven {
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
url("${project(':react-native-background-fetch').projectDir}/libs")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
Here it is. I changed only compileSdkVersion and targetSdkVersion.
I just upgrade my build.gradle
setting like yours, and did not see any build script problem except the permission.Activity_recognition
on runtime, I believe this is due to the Google Policy changes and it can be solved by request permission manually by yourself. But this is on development setting instead of production.
If you wonder the “Sample app” configuration, you can take a look, be ware that those configs can be wrong depends on your need. Sometimes the issue can be temporary cache issues from react native project.
Same issue here any solution so far ?
I 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
I 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
It 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 version
is 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
This is because you should have fitness version 20.0.0 to run this library. I think this can be added to Documentation. Check out the release notes from here to find out what's changed. https://developers.google.com/android/guides/releases
@ensargunesdogdu good point, I can add it later. If developers does not hard set fitness version in their own apps, They wouldn't have the problem. Ppl who encountered the similar issues was because they followed the temp solution in the past when google decided to drop some deprecated codes, which it's fixed later but they did not remove the temp version.
Same issue as --> https://github.com/StasDoskalenko/react-native-google-fit/issues/206#issuecomment-765308172
Getting below error: Cannot resolve symbol 'TYPE_SLEEP_SEGMENT'
But here: https://developers.google.com/fit/datatypes/sleep
Data type object | TYPE_SLEEP_SEGMENT
Mentioned in the DOC.
Any Solution?
@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 me
Fixed by add
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
authVersion = "18.0.0"
fitnessVersion = "20.0.0"
}
...
}
to android/build.gradle
I upgraded to 0.16.1 and now while I'm trying to run the project but I'm getting those issues:
I've already cleaned build, Gradle, node_modules and don't know what to do next