简体   繁体   中英

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..). So I uninstall jdk 16 and install 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.

The problem is with jdk 16 . We have to uninstall jdk 16 and install jdk 8 .

After that, add the jdk path into the environment variable.

  • In Admin part, click new => name it " JAVA_HOME " and input the path.
  • In System variable part, click new => name it " JAVA_HOME " and input the path.
  • In System variable part, click on ' path ' => click ' edit ' => then add %JAVA_HOME%\bin

Then you might see some problem with the gradle . So go to https://gradle.org/install/ Then follow the "Installing manually" section.

  • Download gradle, which will be in zip file
  • Create a folder called Gradle
  • Extract gradle.zip into Gradle folder.

In System variable part, click on ' path ' => click ' edit ' => then add C:\Gradle\gradle-6.8.3\bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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