Home > Blockchain >  React native project I just created does not build
React native project I just created does not build

Time:04-12

Creating a new react native project. I'm trying to get a build when the project is created, but I'm getting an error.

Here is the terminal output.

Task :react-native-gradle-plugin:compileKotlin 'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 11) jvm target compatibility should be set to the same Java version. w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (10, 37): 'BaseVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (119, 30): 'BaseVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (135, 26): 'BaseVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (155, 32): 'BaseVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (161, 31): 'BaseVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt: (169, 36): 'BaseVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt: (99, 48): 'reactRoot: DirectoryProperty' is deprecated. reactRoot was confusing and has been replace with rootto point to your root project and reactNativeDir to point to the folder of the react-native NPM package w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (10, 37): 'ApplicationVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (11, 37): 'BaseVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (12, 37): 'LibraryVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (28, 51): 'BaseVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (131, 12): 'ApplicationVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (132, 12): 'LibraryVariant' is deprecated. Deprecated in Java w: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (250, 14): 'BaseVariant' is deprecated. Deprecated in Java

Task :react-native-gradle-plugin:compileJava 6 actionable tasks: 6 executed Note: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • Where: Build file '/Users/bulutklinik/Desktop/JitsiProject/android/app/build.gradle' line: 1

  • What went wrong: A problem occurred evaluating project ':app'.

Failed to apply plugin 'com.android.internal.application'. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: - changing the IDE settings. - changing the JAVA_HOME environment variable. - changing org.gradle.java.home in gradle.properties.

  • 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.

BUILD FAILED in 50s

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 Note: /Users/bulutklinik/Desktop/JitsiProject/node_modules/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • Where: Build file '/Users/bulutklinik/Desktop/JitsiProject/android/app/build.gradle' line: 1

  • What went wrong: A problem occurred evaluating project ':app'.

Failed to apply plugin 'com.android.internal.application'. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: - changing the IDE settings. - changing the JAVA_HOME environment variable. - changing org.gradle.java.home in gradle.properties.

  • 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.

BUILD FAILED in 50s

at makeError (/Users/bulutklinik/Desktop/JitsiProject/node_modules/execa/index.js:174:9)
at /Users/bulutklinik/Desktop/JitsiProject/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/bulutklinik/Desktop/JitsiProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/bulutklinik/Desktop/JitsiProject/node_modules/@react-native-community/cli/build/index.js:192:9)

info Run CLI with --verbose flag for more details.

CodePudding user response:

Check your environnement setup and your java variables in the path.

Also make sure you closed all the previous build consoles.

CodePudding user response:

I noticed this. The version of my project is 0.68.0 which is the current version of react native.

Then I created a new project and selected the version as 0.67.3. There was no problem. I think the main source of the problem is the version.

  • Related