[英]React Native - Make sure Gradle is running on a JDK, not JRE
I had an app in Expo
and used expo eject
.我在
Expo
有一个应用程序并使用了expo eject
。
My app runs fine on iOS
using npx react-native run-ios
我的应用程序使用
npx react-native run-ios
在iOS
上运行良好
Running on Android im having problems, getting the following issue:在 Android 上运行时遇到问题,出现以下问题:
> Task :unimodules-core:compileDebugKotlin 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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
362 actionable tasks: 5 executed, 357 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':unimodules-core:compileDebugKotlin'.
> Kotlin could not find the required JDK tools in the Java installation '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
In the Directory /Library/Internet Plug-Ins
I have:在目录
/Library/Internet Plug-Ins
我有:
And this is my bash_profile:这是我的 bash_profile:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
export JAVA_HOME=/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
Here is my build.gradle
file:这是我的
build.gradle
文件:
buildscript {
ext {
buildToolsVersion = "30.0.0"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.3'
classpath("com.android.tools.build:gradle:4.0.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
my gradle-wrapper.properties
file:我的
gradle-wrapper.properties
文件:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Tried various stackoverflow posts but Cant seem to fix this issue, any help is much appreciated.尝试了各种stackoverflow帖子,但似乎无法解决这个问题,非常感谢任何帮助。
The problem seems to be with JDK.问题似乎出在 JDK 上。 Have you installed JDK in your system?
你的系统安装JDK了吗? Try downloading JDK with v8 and try again.
尝试使用 v8 下载 JDK,然后重试。 It should run.
它应该运行。 Try installing particular to 8 if any other is installed.
如果安装了任何其他,请尝试安装特定于 8。
You can find officiel package from here-您可以从这里找到官方软件包-
https://www.oracle.com/in/java/technologies/javase/javase8-archive-downloads.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.