Device error on Android device
I want to run the app on my real Android device, but I am getting this error:
Running command: D:\WebStorm\Path\platforms\android\cordova\run.bat ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40 WARNING : No target specified, deploying to device '02c5cabed02456d5'. Running: D:\WebStorm\Path\platforms\android\gradlew cdvBuildDebug -b D: \WebStorm\Path\platforms\android\build.gradle -PcdvBuildArch=arm -Dorg. gradle.daemon=true Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException : Connection refused: connect at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc essManager.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.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketI mpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja va:345) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket Impl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java :188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:432) at sun.net.www.http.HttpClient.openServer(HttpClient.java:527) at sun.net.www.http.HttpClient.<init>(HttpClient.java:211) at sun.net.www.http.HttpClient.New(HttpClient.java:308) at sun.net.www.http.HttpClient.New(HttpClient.java:326) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC onnection.java:1168) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConn ection.java:1104) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne ction.java:998) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection .java:932) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLCo nnection.java:1512) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon nection.java:1440) 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(ExclusiveFileAcc essManager.java:65) ... 3 more D:\WebStorm\Path\platforms\android\cordova\node_modules\q\q.js:126 throw e; ^ Error code 1 for command: cmd with args: /s /c "D:\WebStorm\Path\platfo rms\android\gradlew cdvBuildDebug -b D:\WebStorm\Path\platforms\android \build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true" ERROR running one or more of the platforms: Error: D:\WebStorm\Path\pla tforms\android\cordova\run.bat: Command failed with exit code 8 You may not have the required environment or OS to run this project
I installed Android sdk and I added the following to my Path on Windows7:
C:\Development\android-sdk\platform-tools; C:\Development\android-sdk\tools; C:\Development\android-sdk\android-sdk
Where is the problem?
source to share
It seems that the problem is only with the proxy. You can set up a proxy server in two ways.
- Create / Modify
gradle.properties
@c:\Users\<username>\.gradle\
OR
- Open your project location and do the same as above.
Example:
platforms/android/gradle.properities
- Writing below content to file
systemProp.http.proxyHost=proxyhost
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=pwd
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.https.proxyHost=proxyhost
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=pwd
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
source to share
This link helped me: http://forum.ionicframework.com/t/proxy-error-when-downloading-gradle-zip-during-ionic-emulate-android/31701
To find .gradle
, go to your user folder (by default this is c:\Users\<your login>
). In case it gradle.properties
doesn't exist, just create one
source to share
Looking at your stack it seems to be some kind of connection issue. Is your computer using some kind of proxy to connect to the network? if so, they should also be customized for your build tool. As I see it is just trying to download gradle -2.2.1-all.zip and it doesn't work due to a connection problem.
Solution: Steps to set up a proxy in nodejs
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Hope this information helps you.
Himanshu relationship
source to share