Skip to content

Not able to run this app in local system #3

Description

@bhavishya217

I have been trying to run this example,

Environment:
- Windows 11 pro
"react": "16.8.4",
"react-native": "^0.68.1",
"react-native-google-fit": "^0.9.10-beta"

It had some issue with buildToolsVersion and classpath in the dependencies object in build.gradle file.
I am not able to run the app even after updating these files.

updated build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 27
        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = '17.0.0'
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven { url "https://maven.google.com" }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}


task wrapper(type: Wrapper) {
    gradleVersion = '4.7'
    distributionUrl = distributionUrl.replace("bin", "all")
}

updated gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

The app is throwing 3 errors when I try to run npm run-android,

BUILD FAILED in 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
D:\Juvoxa\react-native-google-fit-example\node_modules\react-native-google-fit\android\src\main\java\com\reactnative\googlefit\StepHistory.java:137: error: cannot find symbol
            if (dataSource.getName() != null) {
                          ^
  symbol:   method getName()
  location: variable dataSource of type DataSource
D:\Juvoxa\react-native-google-fit-example\node_modules\react-native-google-fit\android\src\main\java\com\reactnative\googlefit\StepHistory.java:138: error: cannot find symbol
                source.putString("name", dataSource.getName());
                                                   ^
  symbol:   method getName()
  location: variable dataSource of type DataSource
D:\Juvoxa\react-native-google-fit-example\node_modules\react-native-google-fit\android\src\main\java\com\reactnative\googlefit\RecordingApi.java:56: error: cannot find symbol
                return DataType.TYPE_ACTIVITY_SAMPLES;
                               ^
  symbol:   variable TYPE_ACTIVITY_SAMPLES
  location: class DataType
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 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.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

All the errors seems from the java files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions