Ionic 由于版本问题,运行子进程cordova时出错

mhd8tkvw  于 2022-12-08  发布在  Ionic
关注(0)|答案(1)|浏览(169)

正在检查Java JDK和Android SDK版本ANDROID_SDK_ROOT=未定义(建议设置)ANDROID_HOME=c:\Users\krishna kale\AppData\Local\Android\Sdk(已弃用)JDK 1.8.x的要求检查失败!检测到的版本:17.0.1检查ANDROID_SDK_ROOT / JAVA_HOME / PATH环境变量。[错误]执行子程序cordova时发生错误。
我不想改变我的环境变量,有没有办法通过改变应用程序中的依赖关系来建立这个问题?为什么会出现这个问题?

nnsrf1az

nnsrf1az1#

If you are using ionic 1 - 3, you need to change the environment variables. I have tested Ionic 3 with other java version other than 1.8, and it didn't work.
The newer java version has a new path created under "System variables" > "Path" on the top.
You can retain 2 java versions and revert back to your current java version (17.0.1) once you have built your app.
You can follow these steps:

  1. Download and Install Java SDK 1.8 from the official website.
  2. Once installed, it should be saved in C:/Program Files/Java directory
  3. Go to your Environment Variables > System variables
  4. Click on "New.." to create a new variable.
  5. Variable name = JAVA_HOME and Variable value = C:\Program Files\Java\jdk1.8.0_321 or check on your directory.
  6. Then double click on "Path" variable under System variables.
  7. Click "New" and add %JAVA_HOME%\bin
  8. Once created, select the newly created environment and move it to the very top (Make sure that it's above C:\Program Files\Common Files\Oracle\Java\javapath)
    Reverting back to original version
  9. Go to System variables and double click on "Path"
  10. Remove the newly created variable = %JAVA_HOME%\bin
  11. You should get back your original java version.

相关问题