当我运行命令
ionic cordova build android
运行上面的命令后,我得到以下结果,并尝试以几种方式解决它,但没有任何效果。
ANDROID_HOME=C:\Users\Sumburane\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_60
Subproject Path: CordovaLib
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
[ERROR] An error occurred while running subprocess cordova.
cordova build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
有关我的应用程序的更多详细信息,请参见我的离子信息的详细信息
请勿阅读
有关我的应用程序的更多详细信息,请参见我的离子信息的详细信息。
关于我上面已经解释的细节,我只是在写这篇文章,以防止出现此错误,看来您的帖子大部分是代码;请添加更多详细信息。。在编辑此问题时,请为此道歉。
Ionic:
ionic (Ionic CLI) : 4.12.0 (C:\Users\Sumburane\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.5
@ionic/app-scripts : 3.2.2
Capacitor:
capacitor (Capacitor CLI) : 1.0.0-beta.24
@capacitor/core : 1.0.0-beta.24
Cordova:
cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 6.4.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 5 other plugins)
System:
NodeJS : v8.9.3 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10
答案 0 :(得分:0)
这似乎是出于一些原因。
如果成绩项目位于外部或网络驱动器上,请尝试将其移至包含Android SDK的本地驱动器,然后尝试重新构建。
降级到JDK 8,然后重试。
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html