PhoneGap中文网

标题: 新人求助,cordova build 执行不成功的问题 [打印本页]

作者: weiweicat333    时间: 2016-3-17 16:19
标题: 新人求助,cordova build 执行不成功的问题
D:\>cordova create hello com.example.hello HelloWorld
Creating a new cordova project.

D:\>cd hello

D:\hello>cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: com.example.hello
        Name: HelloWorld
        Activity: MainActivity
        Android target: android-23
Android project created with cordova-android@5.1.1
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.


D:\hello>cordova build
ANDROID_HOME=D:\adt-bundle-windows-x86-20130917\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_73
Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip

Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Error writing to server
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
        at org.gradle.wrapper.Install.createDist(Install.java:47)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.io.IOException: Error writing to server
        at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:666)
        at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:678)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
        at org.gradle.wrapper.Download.download(Download.java:45)
        at org.gradle.wrapper.Install$1.call(Install.java:60)
        at org.gradle.wrapper.Install$1.call(Install.java:47)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        ... 3 more
ERROR building one of the platforms: Error code 1 for command: cmd with args: /s,/c,"D:\hello\platforms\android\gradlew cdvBuildDebug -b D:\hello\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
You may not have the required environment or OS to build this project
Error: Error code 1 for command: cmd with args: /s,/c,"D:\hello\platforms\android\gradlew cdvBuildDebug -b D:\hello\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"


我每次创建一个hello 都能成功 ,但是添加安卓平台,会出现一句This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
然后我在cordova build  就会出现Error: Error code 1 for command: cmd with args: /s,/c,"D:\hello\platforms\android\gradlew cdvBuildDebug -b D:\hello\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
请问这个到底怎么解决啊???我已经折腾好几天了,希望大神帮帮我啊~拜托了


一下是我电脑里装的java 等一些情况
D:\hello>java -version
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.73-b02, mixed mode)

D:\hello>ant -version
Apache Ant(TM) version 1.8.3 compiled on February 26 2012

D:\hello>npm -v
3.6.0
作者: weiweicat333    时间: 2016-3-17 16:24
对了,我的电脑是win10  64位

QQ截图20160317161443.jpg (23.64 KB, 下载次数: 560)

QQ截图20160317161443.jpg

QQ截图20160317162514.jpg (278.18 KB, 下载次数: 531)

QQ截图20160317162514.jpg

QQ截图20160317162528.jpg (214.2 KB, 下载次数: 575)

QQ截图20160317162528.jpg

QQ截图20160317162537.jpg (205.54 KB, 下载次数: 522)

QQ截图20160317162537.jpg

QQ截图20160317162544.jpg (206.41 KB, 下载次数: 548)

QQ截图20160317162544.jpg

QQ截图20160317162549.jpg (227.9 KB, 下载次数: 540)

QQ截图20160317162549.jpg

作者: 随风飘    时间: 2016-3-17 16:35
是不是项目那里安装了不能使用的插件,把部分插件卸了试下?
作者: weiweicat333    时间: 2016-3-17 16:46
本帖最后由 weiweicat333 于 2016-3-17 16:47 编辑
随风飘 发表于 2016-3-17 16:35
是不是项目那里安装了不能使用的插件,把部分插件卸了试下?

您好,非常感谢您的回帖,我查看了一下,我这个插件只有cordova-plugin-whitelist 1.2.1 "Whitelist",删除了这个插件之后,在编译的时候,还会出现Error: Error code 1 for command: cmd with args: /s,/c,"D:\hello\platforms\android\gradlew cdvBuildDebug -b D:\hello\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"这个错误。不知道哪里出现了问题。

D:\hello>cordova plugin ls
cordova-plugin-whitelist 1.2.1 "Whitelist"

D:\hello>cordova plugin rm cordova-plugin-whitelist
Uninstalling cordova-plugin-whitelist from android
Uninstalling cordova-plugin-whitelist from browser
Removing "cordova-plugin-whitelist"

D:\hello>cordova build android
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for android

               This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

Installing "cordova-plugin-whitelist" for browser
ANDROID_HOME=D:\adt-bundle-windows-x86-20130917\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_73
Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip

Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Error writing to server
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
        at org.gradle.wrapper.Install.createDist(Install.java:47)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.io.IOException: Error writing to server
        at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:666)
        at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:678)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
        at org.gradle.wrapper.Download.download(Download.java:45)
        at org.gradle.wrapper.Install$1.call(Install.java:60)
        at org.gradle.wrapper.Install$1.call(Install.java:47)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        ... 3 more
ERROR building one of the platforms: Error code 1 for command: cmd with args: /s,/c,"D:\hello\platforms\android\gradlew cdvBuildDebug -b D:\hello\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
You may not have the required environment or OS to build this project
Error: Error code 1 for command: cmd with args: /s,/c,"D:\hello\platforms\android\gradlew cdvBuildDebug -b D:\hello\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

D:\hello>cordova platform ls
Installed platforms: android 5.1.1, browser 4.0.0
Available platforms: amazon-fireos, blackberry10, firefoxos, webos, windows, windows8, wp8

D:\hello>cordova platform rm browser

D:\hello>cordova platform ls
Installed platforms: android 5.1.1
Available platforms: amazon-fireos, blackberry10, browser, firefoxos, webos, windows, windows8, wp8

作者: tanxuxu123    时间: 2016-3-22 17:53
我也遇到这样问题,怎么解的
作者: 随风飘    时间: 2016-4-1 17:02
编译不成功,可能是Android SDK的问题,使用代理,把最新的SDK更新,全点上去下载,我之前也试过这种情况,把Android 6.0的sdk全下了就可以了




欢迎光临 PhoneGap中文网 (http://bbs.phonegap100.com/) Powered by Discuz! X3.2