A problem occurred configuring project ':CordovaLib'. An error occurred while running subprocess

H:\IonicSpace\MyApp>"I:\Program Files\Java\jdk1.8.0_73/bin/java.exe"    "-Dorg.gradle.appname=gradlew" -classpath "H:\IonicSpace\MyApp\platforms\android\\gradle\wrapper\gradle-wrapper.jar" org.gradle.wrapper.GradleWrapperMain cdvBuildDebug -b H:\IonicSpace\MyApp\platforms\android\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.

H:\IonicSpace\MyApp>if "1" == "0" goto mainEnd

H:\IonicSpace\MyApp>rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of

H:\IonicSpace\MyApp>rem the _cmd.exe /c_ return code!

H:\IonicSpace\MyApp>if not "" == "" exit 1

H:\IonicSpace\MyApp>exit /b 1
Command finished with error code 1: cmd /s /c "H:\IonicSpace\MyApp\platforms\android\gradlew.bat cdvBuildDebug -b H:\IonicSpace\MyApp\platforms\android\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m"
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
   > Could not download maven-ant-tasks.jar (org.apache.maven:maven-ant-tasks:2.1.3)
      > Could not get resource 'https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar'.
         > Could not GET 'https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar'.
            > Remote host closed connection during handshake
   > Could not download commons-collections.jar (commons-collections:commons-collections:3.2.1)
      > Could not get resource 'https://jcenter.bintray.com/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar'.
         > Could not GET 'https://jcenter.bintray.com/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar'.
            > Remote host closed connection during handshake
   > Could not download xercesImpl.jar (xerces:xercesImpl:2.9.1)
      > Could not get resource 'https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar'.
         > Could not GET 'https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar'.
            > Remote host closed connection during handshake

* 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 2m 25s
    at ChildProcess.whenDone (H:\IonicSpace\MyApp\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
   > Could not download maven-ant-tasks.jar (org.apache.maven:maven-ant-tasks:2.1.3)
      > Could not get resource 'https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar'.
         > Could not GET 'https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar'.
            > Remote host closed connection during handshake
   > Could not download commons-collections.jar (commons-collections:commons-collections:3.2.1)
      > Could not get resource 'https://jcenter.bintray.com/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar'.
         > Could not GET 'https://jcenter.bintray.com/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar'.
            > Remote host closed connection during handshake
   > Could not download xercesImpl.jar (xerces:xercesImpl:2.9.1)
      > Could not get resource 'https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar'.
         > Could not GET 'https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar'.
            > Remote host closed connection during handshake

* 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 2m 25s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> Could not resolve all files for configuration ':CordovaLib:classpath'.
   > Could not download maven-ant-tasks.jar (org.apache.maven:maven-ant-tasks:2.1.3)
      > Could not get resource 'https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar'.
         > Could not GET 'https://jcenter.bintray.com/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar'.
            > Remote host closed connection during handshake
   > Could not download commons-collections.jar (commons-collections:commons-collections:3.2.1)
      > Could not get resource 'https://jcenter.bintray.com/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar'.
         > Could not GET 'https://jcenter.bintray.com/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar'.
            > Remote host closed connection during handshake
   > Could not download xercesImpl.jar (xerces:xercesImpl:2.9.1)
      > Could not get resource 'https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar'.
         > Could not GET 'https://jcenter.bintray.com/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar'.
            > Remote host closed connection during handshake

* 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 2m 25s
这个地方可能用得到,如果是这样的问题的话,
[ERROR] An error occurred while running subprocess cordova.
        cordova build android --verbose exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: running 2 functions +10ms
  ionic:cli-framework:utils:process error while killing process tree for 10448: { Error: Command failed: taskkill /pid 10448 /T /F
  ionic:cli-framework:utils:process ����: û���ҵ����� "10448"��
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:276:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:915:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 10448 /T /F' } +192ms
  ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 10448 /T /F
  ionic:cli-framework:utils:process ����: û���ҵ����� "10448"��
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:276:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:915:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 10448 /T /F' } +6ms
  ionic:cli-framework:utils:process error while killing process tree for 3320: { Error: Command failed: taskkill /pid 3320 /T /F
  ionic:cli-framework:utils:process ����: û���ҵ����� "3320"��
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:276:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:915:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 3320 /T /F' } +30ms
  ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 3320 /T /F
  ionic:cli-framework:utils:process ����: û���ҵ����� "3320"��
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:276:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:915:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 3320 /T /F' } +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +0ms
PS H:\IonicSpace\MyApp> ionic cordova build android
> ng run app:ionic-cordova-build --platform=android
��ֹ�����������(Y/N)?
终止批处理操作吗(Y/N)? y
PS H:\IonicSpace\MyApp>
PS H:\IonicSpace\MyApp>
PS H:\IonicSpace\MyApp>
PS H:\IonicSpace\MyApp>
PS H:\IonicSpace\MyApp> ionic cordova build android

以上错误的原因是gradle的版本是不对的,应该用gradle-4.10-rc-1版本(为什么真的不知道–)。
下载完之后记得配置Gradle的环境变量。并且,注意,要关闭原来跑命令的DOS窗口,重新开,不然环境变量不起作用的。
另外如果报错说missing 什么平台啥的,那就是SDK tools 没装好。

你可能感兴趣的:(A problem occurred configuring project ':CordovaLib'. An error occurred while running subprocess)