'React native app(just created) crashes with following error messages when install packages like react-native-gesture handle
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
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
Where: Build file 'E:\React_native\paperboy\node_modules\react-native-gesture-handler\android\build.gradle' line: 27
What went wrong: A problem occurred evaluating project ':react-native-gesture-handler'.
Could not initialize class org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSetKt
- 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. ==============================================================================
2: Task failed with an exception.
- What went wrong: A problem occurred configuring project ':react-native-gesture-handler'.
compileSdkVersion is not specified. Please add it to build.gradle
- 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 14s
at makeError (E:\React_native\paperboy\node_modules\execa\index.js:174:9)
at E:\React_native\paperboy\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (E:\React_native\paperboy\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (E:\React_native\paperboy\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
Solution 1:[1]
Try to remove the if..else condition in your build.gradle file under the signingConfigs > release.
Example:
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file('xxx')
storePassword 'xxx'
keyAlias 'xxx'
keyPassword 'xxx'
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rakibtg |
