当我尝试运行“D:\ MyApp \ app> ionic build android”命令时出现错误。所有进程都正常工作。可以告诉我适当的解决方案。提前谢谢。
D:\MyApp\app>ionic build android
Running command: "C:\Program Files (x86)\nodejs\node.exe" D:\MyApp\app\hooks\aft
er_prepare\010_add_platform_class.js D:\MyApp\app
add to body class: platform-android
Running command: cmd "/s /c "D:\MyApp\app\platforms\android\cordova\build.bat""
ANDROID_HOME=C:\Users\rajitha\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79
Running: D:\MyApp\app\platforms\android\gradlew cdvBuildDebug -b D:\MyApp\app\pl
atforms\android\build.gradle -Dorg.gradle.daemon=true
FAILURE: Build failed with an exception.
我无法理解他们告诉我什么。因为我设置了所有环境变量ex-JAVA,ANDROID
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:1.0.0+.
Required by:
:android:unspecified
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://repo1.maven.org/maven2/co
m/android/tools/build/gradle/maven-metadata.xml.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/bu
ild/gradle/maven-metadata.xml'.
> Connection to https://repo1.maven.org refused
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 6.474 secs
D:\MyApp\app\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "D:\MyApp\app\platforms\android\g
radlew cdvBuildDebug -b D:\MyApp\app\platforms\android\build.gradle -Dorg.gradle
.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\rajitha\AppData\Roaming\npm\node_modules\
cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
答案 0 :(得分:2)
我得到了同样的错误。我刚刚关闭防火墙,它没有错误地构建。所以你必须检查连接是否正确。确保你可以ping https://repo1.maven.org(我能够,但是cordova被防火墙蒙蔽了)以确保目标可以访问