I have not used react-native for a while. The old project properly installs to device but now when i am creating a new react-native project and trying to install it to the device, it fails showing the following error.
FAILURE: Build failed with an exception.
- What went wrong: A problem occurred configuring root project 'Tracks'.
Could not resolve all artifacts for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.5.3. Required by: project : > Could not resolve com.android.tools.build:gradle:3.5.3. > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'. > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'. > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
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
BUILD FAILED in 5s
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 app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
- What went wrong: A problem occurred configuring root project 'Tracks'.
Could not resolve all artifacts for configuration ':classpath'. Could not resolve com.android.tools.build:gradle:3.5.3. Required by: project : > Could not resolve com.android.tools.build:gradle:3.5.3. > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'. > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'. > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
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
BUILD FAILED in 5s
at makeError (/Users/kherkatarybhaskar/Downloads/ReactNative/Tracks/node_modules/execa/index.js:174:9)
at /Users/kherkatarybhaskar/Downloads/ReactNative/Tracks/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (/Users/kherkatarybhaskar/Downloads/ReactNative/Tracks/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/Users/kherkatarybhaskar/Downloads/ReactNative/Tracks/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js:186:9)
info Run CLI with --verbose flag for more details.