简体   繁体   English

Ionic Angular & Android Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper

[英]Ionic Angular & Android Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper

At first it said I can't run the code because my jdk is 16 and the required jdk is 8 (1.8..).起初它说我无法运行代码,因为我的 jdk 是 16,而所需的 jdk 是 8 (1.8..)。 So I uninstall jdk 16 and install jdk 8.所以我卸载 jdk 16 并安装 jdk 8。

Now I encounter this strange issue.现在我遇到了这个奇怪的问题。 Please have a look at this.请看看这个。

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\Admin\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=C:\Users\Admin\AppData\Local\Android\Sdk\ (DEPRECATED)
Using Android SDK: C:\Users\Admin\AppData\Local\Android\Sdk
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd build android --device exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

Assuming ANDROID_HOME & ANDROID_SDK_ROOT are all set.假设ANDROID_HOME & ANDROID_SDK_ROOT都设置好了。

The problem is with jdk 16 .问题出在jdk 16上。 We have to uninstall jdk 16 and install jdk 8 .我们必须卸载jdk 16并安装jdk 8

After that, add the jdk path into the environment variable.之后,将 jdk 路径添加到环境变量中。

  • In Admin part, click new => name it " JAVA_HOME " and input the path.在 Admin 部分,单击 new => 将其命名为“ JAVA_HOME ”并输入路径。
  • In System variable part, click new => name it " JAVA_HOME " and input the path.在系统变量部分,单击新建 => 将其命名为“ JAVA_HOME ”并输入路径。
  • In System variable part, click on ' path ' => click ' edit ' => then add %JAVA_HOME%\bin在系统变量部分,单击“ path ”=>单击“ edit ”=>然后添加%JAVA_HOME%\bin

Then you might see some problem with the gradle .然后你可能会看到gradle的一些问题。 So go to https://gradle.org/install/ Then follow the "Installing manually" section.所以 go 到https://gradle.org/install/然后按照“手动安装”部分。

  • Download gradle, which will be in zip file下载 gradle,将在 zip 文件中
  • Create a folder called Gradle创建一个名为 Gradle 的文件夹
  • Extract gradle.zip into Gradle folder.gradle.zip提取到 Gradle 文件夹中。

In System variable part, click on ' path ' => click ' edit ' => then add C:\Gradle\gradle-6.8.3\bin在系统变量部分,单击“ path ”=>单击“ edit ”=>然后添加C:\Gradle\gradle-6.8.3\bin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM