可能是问题所在了。但是,“ gradle -v”命令可以在cmd上成功执行并查看gradle版本。但是我单独下载并设置了路径变量以使用gradle。
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\intern\AppData\Local\Android\Sdk\ (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
C:\Users\intern\Desktop\ionic\MyIonicProject\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
[ERROR]运行子进程cordova时发生错误。
cordova.cmd build android exited with exit code 1.
答案 0 :(得分:0)
如果您使用的是Cordova版本> = 7或Android SDK Tools> = 26,则需要手动安装gradle(reference)。在Windows 10上,您可以这样安装gradle:
C:\gradle
C:\gradle\bin
(gradle.bat
所在的目录)之后,您应该能够正常构建项目。
答案 1 :(得分:0)