Error in build on device Android - java

I want to run my app on my real device Android but I receive 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 the Android sdk and I added to my Path in Windows7 this:
C:\Development\android-sdk\platform-tools;
C:\Development\android-sdk\tools;
C:\Development\android-sdk\android-sdk
Where is the problem???

It is seems be issue with proxy only.
You can set proxy in two ways.
Create/Edit gradle.properties # c:\Users\<username>\.gradle\
OR
Goto your project location and do the same as above
Example : platforms/android/gradle.properities
Write below content in 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

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 (default is c:\Users\<your login>). In case gradle.properties is not existing, simply create one

Looking at your stacktrace it seems to be some kind of connectivity problem. Is your computer is using any proxy to connect to network? if yes then that have to be configured for your build tool as well. As i can see it is just trying to download gradle-2.2.1-all.zip and it is failing due to connection problem.
Solution: Steps to configure proxy in nodejs
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Hope that information helps you.
Regards
Himanshu

Related

Unable to connect Docker Container using HttpURLConnection in Java

I have created two Web Projects in java.
One of the project was running inside the Tomcat docker container:
192.160.1.5:8080/SocketServer
Another project was running in local machine using eclipse
localhost:8081/SocketClient
I am trying to connect the SocketServer project running inside docker container from the SocketClient using HttpURLConnection in java. But it gives some errors like below:
java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.connect0(Native Method)
at java.base/sun.nio.ch.Net.connect(Net.java:574)
at java.base/sun.nio.ch.Net.connect(Net.java:563)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333)
at java.base/java.net.Socket.connect(Socket.java:648)
at java.base/java.net.Socket.connect(Socket.java:597)
at java.base/java.net.Socket.<init>(Socket.java:520)
at java.base/java.net.Socket.<init>(Socket.java:370)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at com.dump.LogAction.startSocket(LogAction.java:61)
at com.dump.LogAction.execute(LogAction.java:37)
How can I resolve this?
This is normal behavior, you should read the docs.
https://docs.docker.com/network/network-tutorial-host/
Quick answer: run the docker image with --network host argument OR you need to expose a port publicly https://www.whitesourcesoftware.com/free-developer-tools/blog/docker-expose-port/ --expose 8080

GRADLE Build Error : Permission Denied: No further information

Caused by: java.net.SocketException: Permission denied: no further information
at `sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:111)
at org.gradle.internal.remote.internal.inet.TcpOutgoingConnector.tryConnect(TcpOutgoingConnector.java:81)
at org.gradle.internal.remote.internal.inet.TcpOutgoingConnector.connect(TcpOutgoingConnector.java:54)`
... 29 more
This error occurs when I connect to VPN, if not connect it works fine.
I need to use VPN for new libraries, Please suggest the best answer to resolve this.
Disabling firewall does not work for me
placing gradle.properties in .gradle folder did not worked.
adding _JAVA_OPTION allowing ipv4 stack also did not worked.gradle build
This issue will resolved by directing the cacerts with all installed certificates in to your gradle.properties. No JAVA Args required.

Java tzupdater throws Caused by: java.net.UnknownHostException: c

I followed the Oracle > Known Issues > Version issue since tzdata 2016g release and created a file named tzdata2016g.tar.gz on C:\ drive.
Executing (on Windows 2008 R2):
java.exe -jar c:\tzupdater.jar -l file://C:/tzdata2016g.tar.gz -v
Returns:
Using file://C:/tzdata2016g.tar.gz as source for tzdata bundle.
java.home: ---
java.vendor: Oracle Corporation
java.version: 1.8.0_102
tzupdater version 2.1.0-b04
JRE tzdata version: tzdata2016d
Error encountered while downloading file://C:/tzdata2016g.tar.gz
Exception in thread "main" com.sun.tools.tzupdater.TzRuntimeException: com.sun.tools.tzupdater.TzRuntimeException: Error encountered while downloading file://C:/tzdata2016g.tar.gz
at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:662)
Caused by: com.sun.tools.tzupdater.TzRuntimeException: Error encountered while downloading file://C:/tzdata2016g.tar.gz
at com.sun.tools.tzupdater.ExternalModule.downloadFile(ExternalModule.java:70)
at com.sun.tools.tzupdater.TimezoneUpdater.run(TimezoneUpdater.java:205)
at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:643)
Caused by: java.net.UnknownHostException: C
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.Socket.connect(Socket.java:589)
at sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:952)
at sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:917)
at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1012)
at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:998)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:294)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393)
at com.sun.tools.tzupdater.ExternalModule.downloadFile(ExternalModule.java:44)
... 2 more
Pasting the URL file://C:/tzdata2016g.tar.gz in Google Chrome works (the file is found and downloaded).
Tried multiple slashes and CaSiNg the C drive, but nothing helps.
Also tried file://localhost/C:/tzdata2016g.tar.gz and other variations.
Any ideas?
Or maybe someone created the tzdata2016g.tar.gz and cares to share? Maybe I did something wrong when created it...
First, download the files from: https://github.com/kumlali/tzupdater_2016g_workaround
Then, run with three slashes after file:
java.exe -jar c:\tzupdater.jar -l file:///C:/tzdata2016g.tar.gz -v

DocumentDB Java SDK behind a proxy

I'm trying to create a simple web application from the todo tutorial.
As I'm behind a corporate proxy, I used the following common java system properties :
-Dhttp.proxyHost=myproxy Dhttp.proxyPort=3128
-Dhttps.proxyHost=myproxy -Dhttps.proxyPort=3128
I also try the following parameter:
-Djava.net.useSystemProxies=true
I still have a client exception
java.lang.IllegalStateException: Http client execution failed.
at com.microsoft.azure.documentdb.GatewayProxy.performPostRequest(GatewayProxy.java:350)
at com.microsoft.azure.documentdb.GatewayProxy.doSQLQuery(GatewayProxy.java:135)
at com.microsoft.azure.documentdb.DocumentClient.doQuery(DocumentClient.java:2013)
(...)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:625)
I would like to know if the azure documentdb sdk enable this proxy settings ? Maybe there is another way to set https proxy for this SDK ?
Following pull request merge, if you want to use a proxy you need to get a release version greater than 1.0.1.
As the release is not available at this moment, you could build github source and use the sdk snapshot version.
Then you just need to setup your proxy through configuration:
-Dhttp.proxyHost=myproxy Dhttp.proxyPort=3128
-Dhttps.proxyHost=myproxy -Dhttps.proxyPort=3128

Class not found when running on a node

I've configured a slave to run on my machine, the slave is connected and recognized by Jenkins.
I've configured my project to use that specific slave and I can see that it kicks into action when a job needs to be done.
After a while I receive the following error:
[Android Tunneling] $ /opt/jdk/jdk1.7.0/bin/java -cp maven3-agent.jar:/opt/maven/apache- maven-3.0.4/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /opt/maven/apache-maven-3.0.4 /home/efi/Documents/jenkins/jenkins-cli.jar maven3-interceptor.jar 34176
Error: Could not find or load main class org.jvnet.hudson.maven3.agent.Maven3Main
ERROR: Failed to launch Maven. Exit code = 1
When running this command locally via terminal I get
Exception in thread "main" java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:337)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:128)
at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:63)
Any idea what might be the problem ?
Command line is looking for maven to be installed on /opt/maven/apache-maven-3.0.4 (default location for cloudbees slaves). If your local setup don't match this, you need to override tools location for this custom slave

Categories