PhoneGap中文网

 找回密码
 立即注册
查看: 44962|回复: 5
打印 上一主题 下一主题

新人求助,cordova build 执行不成功的问题

[复制链接]

1

主题

4

帖子

11

积分

新手上路

Rank: 1

积分
11
跳转到指定楼层
楼主
发表于 2016-3-17 16:19:47 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
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
回复

使用道具 举报

1

主题

4

帖子

11

积分

新手上路

Rank: 1

积分
11
沙发
 楼主| 发表于 2016-3-17 16:24:31 | 只看该作者
对了,我的电脑是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
回复 支持 反对

使用道具 举报

4

主题

7

帖子

38

积分

新手上路

Rank: 1

积分
38
板凳
发表于 2016-3-17 16:35:49 | 只看该作者
是不是项目那里安装了不能使用的插件,把部分插件卸了试下?
回复 支持 反对

使用道具 举报

1

主题

4

帖子

11

积分

新手上路

Rank: 1

积分
11
地板
 楼主| 发表于 2016-3-17 16:46:05 | 只看该作者
本帖最后由 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
回复 支持 反对

使用道具 举报

3

主题

8

帖子

47

积分

新手上路

Rank: 1

积分
47
5#
发表于 2016-3-22 17:53:19 | 只看该作者
我也遇到这样问题,怎么解的
回复 支持 反对

使用道具 举报

4

主题

7

帖子

38

积分

新手上路

Rank: 1

积分
38
6#
发表于 2016-4-1 17:02:58 | 只看该作者
编译不成功,可能是Android SDK的问题,使用代理,把最新的SDK更新,全点上去下载,我之前也试过这种情况,把Android 6.0的sdk全下了就可以了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

ionic4视频教程

Archiver|手机版|小黑屋| PhoneGap中文网 ( 京ICP备13027796号-1 )  

GMT+8, 2024-11-5 23:27 , Processed in 0.085425 second(s), 37 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表