I am new to the React Native development with using Mac M1. When I was running React Native Android, I got the errors below.
I really have no idea how to fix this error, Appreciate if anyone could help, thanks again!
> 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.
> Task :react-native-gradle-plugin:compileKotlin FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (28, 33): Unresolved reference: replaceFirstChar
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (28, 52): Unresolved reference: it
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt: (252, 16): Unresolved reference: lowercase
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt: (13, 38): Unresolved reference: lowercase
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt: (15, 57): Unresolved reference: lowercase
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt: (18, 54): Unresolved reference: lowercase
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt: (19, 52): Unresolved reference: lowercase
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt: (190, 27): Type mismatch: inferred type is Unit but CharSequence was expected
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt: (190, 44): Unresolved reference: replaceFirstChar
e: /Users/fuzhonghan/Documents/AwesomeAndroidProject/node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt: (190, 63): Unresolved reference: it
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gradle-plugin:compileKotlin'.
> Compilation error. See log for more details
command line javac --version result...
javac 11.0.15
command line java --version result...
openjdk 11.0.15 2022-04-19 LTS
OpenJDK Runtime Environment Zulu11.56+19-CA (build 11.0.15+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.56+19-CA (build 11.0.15+10-LTS, mixed mode)
And contents of gradle-wrapper.properties
are below...
(I've downgraded gradle version from 7.1.1 to 6.8 due to plugin maven
was removed from gradle 7.)
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists