I Have installed everything required to run and build ionic app, it was running smoothly until now. Suddenly it has started giving all type of errors. I am new to ionic development so not able to understand this. Even tried google search, but was of no help till now.
I am getting below error, when trying to build application. It works perfectly with serve command in local browser. What could be the issue? Let me know if any more details are required from my side.
C:\Users\Solution\reliableapp>ionic build android
Running command: "C:\Program Files (x86)\nodejs\node.exe" C:\Users\Solution\reli
ableapp\hooks\after_prepare\010_add_platform_class.js C:\Users\Solution\reliable
app
add to body class: platform-android
Running command: cmd "/s /c "C:\Users\Solution\reliableapp\platforms\android\cor
dova\build.bat""
ANDROID_HOME=C:\Users\Solution\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files (x86)\java\jdk1.7.0_71
Running: C:\Users\Solution\reliableapp\platforms\android\gradlew cdvBuildDebug -
b C:\Users\Solution\reliableapp\platforms\android\build.gradle -Dorg.gradle.daem
on=true
Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip
Exception in thread "main" java.lang.RuntimeException: java.net.UnknownHostExcep
tion: downloads.gradle.org
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.UnknownHostException: downloads.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java
:178)
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 java.net.Socket.connect(Socket.java:528)
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:996)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:932)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:850)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLCon
nection.java:2398)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1557)
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
C:\Users\Solution\reliableapp\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "C:\Users\Solution\reliableapp\pl
atforms\android\gradlew cdvBuildDebug -b C:\Users\Solution\reliableapp\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\Solution\AppData\Roaming\npm\node_modules
\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:817:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
C:\Users\Solution\reliableapp>ionic serve
Running live reload server: http://192.168.1.36:35729
Watching : [ 'www/**/*', '!www/lib/**/*' ]
Running dev server: http://192.168.1.36:8100
Ionic server commands, enter:
restart or r to restart the client app from the root
goto or g and a url to have the app navigate to the given url
consolelogs or c to enable/disable console log output
serverlogs or s to enable/disable server log output
quit or q to shutdown the server and exit
ionic $ q
Related
The error on the above title only occurs on this specific project, when I build a Blank project it doesn't get this error. I've tried the other solutions to this problem but I just can't seem to get this working.
Heres the error message:
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
ANDROID_HOME=C:\Users\ME\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_211
Running command: cmd "/s /c ""C:\Program Files (x86)\gradle-5.6.2\bin\gradle.bat" -p C:\Windows\System32\QRID2\qrid\platforms\android wrapper -b C:\Windows\System32\QRID2\qrid\platforms\android\wrapper.gradle""
Command finished with error code ENOENT: cmd /s /c ""C:\Program Files (x86)\gradle-5.6.2\bin\gradle.bat" -p C:\Windows\System32\QRID2\qrid\platforms\android wrapper -b C:\Windows\System32\QRID2\qrid\platforms\android\wrapper.gradle"
cmd: Command failed with exit code ENOENT
Error: cmd: Command failed with exit code ENOENT
at ChildProcess.whenDone (C:\Windows\System32\QRID2\qrid\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:198:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
This means ENOENT Error NO ENTity|ENTry so such derectory
check your gradle is located in C:\Program Files (x86)\gradle-5.6.2
Do you have the gradle installed on your machine?
Try it:
1 - download the gradle from the site gradle.org.
Download the .zip file and extract to disk C:\
2 - Set the Gradle Environment Variables.
In order for the Gradle executable to be visible on the Windows command line, you must set the GRADLE_HOME variable and expose it in the system path.
Example:
variable name: GRADLE_HOME
variable value: c:\gradle-2.5
and then add GRADLE_HOME to Path
;%GRADLE_HOME%\bin
Restart your PC and use de command line
gradle -version
To see if it works
Here is output of meteor run android-device:
meteor run android-device
[[[[[ ~/repo/socialize ]]]]]
=> Started proxy.
=> Started MongoDB. Building for web.browser - Babel compiling files:
client/lib/module/angular-ios9-uiwebview.patch.js
client/lib/module/aws-sdk.min.js [BABEL] Note: The code generator has
deoptimised the styling of "/client/lib/module/aws-sdk.min.js" as it
exceeds the max of "100KB". client/lib/module/helpers.js
client/lib/app.js client/controllers/appCtrl.js
client/controllers/cardsCtrl.js client/controllers/chatCtrl.js
client/controllers/connectionsCtrl.js
client/controllers/eCardCtrl.js
client/controllers/forgetPassCtrle.js
client/controllers/groupsParentCtrl.js
client/controllers/homeCtrl.js client/controllers/loginCtrl.js
client/controllers/myGroupsCtrl.js client/controllers/profileCtrl.js
client/controllers/publicGroupsCtrl.js
client/controllers/recentCtrl.js client/controllers/signUpCtrl.js
client/directives/autoFocus.js client/directives/msdElastic.js
client/directives/resizeFooter.js client/filters/calendar.js
client/filters/chatLinkFilter.js client/filters/chatName.js
client/services/mockService.js client/services/s3BucketService.js
collections/cards/cards.js
collections/cardsCategory/cardsCategory.js
collections/chats/chats.js collections/circles/circles.js
collections/groups/groups.js collections/messages/messages.js
collections/users/users.js client/routes.js Building for
web.cordova - Babel compiling files: Building for
os.linux.x86_64 | Babel compiling files:
server/cards/permissions.js server/cards/publications.js
server/cardsCategory/methods.js server/cardsCategory/permissions.js
server/cardsCategory/publications.js server/cardsCategory/seed.js
server/chats/methods.js server/chats/permissions.js
server/chats/publications.js server/circles/methods.js
server/circles/permissions.js server/circles/publications.js
server/groups/methods.js server/groups/permissions.js
server/groups/publications.js server/messages/methods.js
server/messages/permissions.js server/messages/publications.js
server/users/methods.js server/users/permissions.js
server/users/publications.js server/users/seed.js
WARNING: You are testing your app on a remote device. For the mobile app to be able to
connect to the local server, make sure your device is on the same
network, and that the
network configuration allows clients to talk to each other (no client isolation).
=> Errors executing Cordova commands:
While running Cordova app for platform Android with options --device: >Error:
Command failed:
/home/haider/repo/socialize/.meteor/local/cordova-build/platforms/android/cordova/run
--device
events.js:72
throw er; // Unhandled 'error' event ^
Error: spawn EACCES
at errnoException (child_process.js:1011:11)
at Process.ChildProcess._handle.onexit (child_process.js:802:34) at
ChildProcess.exitCallback (/tools/utils/processes.js:137:23) at
ChildProcess.emit (events.js:98:17) at
Process.ChildProcess._handle.onexit (child_process.js:820:12)
ExitWithCode:1
I'm confused. jdk,sdk,ant,cordova,ionic doing well,why builds error?
I searched everywhere,but no answer for it.
I guess has a error version?
who can help this?
system:win8
jdk:1.8
ant:1.96
android:22
%ANT_HOME%\bin\;%ANDROID_HOME%\platform-tools\;%ANDROID_HOME%\tools\;%java_home%\bin;%java_home%\jre\bin;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\
Path
E:\ionic\demo22>ionic build android
Running command: "C:\Program Files\nodejs\node.exe" E:\ionic\demo22\hooks\after_
prepare\010_add_platform_class.js E:\ionic\demo22
add to body class: platform-android
Running command: cmd "/s /c "E:\ionic\demo22\platforms\android\cordova\build.bat
""
ANDROID_HOME=E:\adt-bundle-windows-x86_64-20140702\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_60
Running: E:\ionic\demo22\platforms\android\gradlew cdvBuildDebug -b E:\ionic\dem
o22\platforms\android\build.gradle -Dorg.gradle.daemon=true
Unzipping C:\Users\cxt\.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oiej
fej094b\gradle-2.2.1-all.zip to C:\Users\cxt\.gradle\wrapper\dists\gradle-2.2.1-
all\2m8005s69iu8v0oiejfej094b
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipExceptio
n: error in opening zip file
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.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:65)
... 3 more
E:\ionic\demo22\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "E:\ionic\demo22\platforms\androi
d\gradlew cdvBuildDebug -b E:\ionic\demo22\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\cxt\AppData\Roaming\npm\node_modules\cord
ova\node_modules\cordova-lib\src\cordova\superspawn.js:139: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)
Error
I hope that not too late, but I had the same error and. So, I fixed it doing the next:
In your case find this:
C:\Users\cxt\.gradle\wrapper\dists\gradle-2.2.1-
all\2m8005s69iu8v0oiejfej094b
now you are here to delete the gradle-2.2.1-all.zip because this file is corrupted and then replace the file with this http://services.gradle.org/distributions/gradle-2.2.1-all.zip
when you finish all try again
ionic build android
Good Luck!
First of all you have to install
node.js
apache ANT
JDK & JRE
Android SDK & Eclipse
After installation, you have to set software paths into environmental- variable. Then fire your npm install -g cordova. Without this PhoneGap will not be created.
If still you have any confusion or question related to software installation then tell me.
I had the same issue on Mac.
The steps below solved that for me:
NOTE: gradle path & version would be different on your machine. please replace those informations with yours. you can get them from exception message
Download : http://services.gradle.org/distributions/gradle-2.13-all.zip
Get List of files in directory
sudo ls rm /var/root/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q
Remove existing zip file
sudo rm /var/root/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q/gradle-2.13-all.zip
If there is a *.zip.lck file, you'd better remove that too..
sudo rm /var/root/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q/gradle-2.13-all.zip.lck
Copy downloaded file to that path
sudo cp /Downloads/gradle-2.13-all.zip /var/root/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q/
Then try to run
ionic run android
When i trying to use ionic build android in cli and it returns
Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException
: Connection timed out: 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 timed out: 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
C:\Users\TCYCAKMAK\simple\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "C:\Users\TCYCAKMAK\simple\platfo
rms\android\gradlew cdvBuildDebug -b C:\Users\TCYCAKMAK\simple\platforms\android
\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\TCYCAKMAK\AppData\Roaming\npm\node_module
s\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:755:16)
at Process.ChildProcess._handle.onexit (child_process.js:822:5)
I installed everything like android sdk, ant etc. Also there is a proxy in my working area. I thought my problem stems from this but i didnt find any solution.
Do you have waited the end of the download of glade in command shell ?
If true
Make a new project and test without modification
If your new project return the same message
Make you sure you have correctly configured your var path environment.
I'm setting up an environment for Phonegap developing, and I'm getting some trouble to finally build and run an app for Android.
When I try to execute build for Android, I got the following error:
Running: C:\Users\Renan\workspace_html5\FIAP\Phonegap\phonegap-test\test\platfor
ms\android\gradlew cdvBuildDebug -b C:\Users\Renan\workspace_html5\FIAP\Phonegap
\phonegap-test\test\platforms\android\build.gradle -Dorg.gradle.daemon=true
Unzipping C:\Users\Renan\.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oi
ejfej094b\gradle-2.2.1-all.zip to C:\Users\Renan\.gradle\wrapper\dists\gradle-2.
2.1-all\2m8005s69iu8v0oiejfej094b
Exception in thread "main"
java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip fil
e
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.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:220)
at java.util.zip.ZipFile.<init>(ZipFile.java:150)
at java.util.zip.ZipFile.<init>(ZipFile.java:164)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:65)
... 3 more
C:\Users\Renan\workspace_html5\FIAP\Phonegap\phonegap-test\test\platforms\androi
d\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "C:\Users\Renan\workspace_html5\F
IAP\Phonegap\phonegap-test\test\platforms\android\gradlew cdvBuildDebug -b C:\Us
ers\Renan\workspace_html5\FIAP\Phonegap\phonegap-test\test\platforms\android\bui
ld.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: C:\Users\Renan\workspace_html5\FIAP\
Phonegap\phonegap-test\test\platforms\android\cordova\build.bat: Command failed
with exit code 8
You may not have the required environment or OS to build this project
Error: C:\Users\Renan\workspace_html5\FIAP\Phonegap\phonegap-test\test\platforms
\android\cordova\build.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Renan\AppData\Roaming\npm\node_modules\ph
onegap\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:1
31:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Some details:
I'm running on Windows 8.1;
I'm using Android SDK 22;
I've already created environment variables for JDK, Android (tools, build-tools and platform-tools), Ant and Gradle.
Any ideas why am I getting this error?
Thank you.
I have already managed to solve this problem, so, in case of anyone has a similar trouble, here it goes the situation I've gone through.
When I performed the first build, phonegap attempted to download and extract it's own gradle distribution, and he was attempting to download it from the follow:
http://services.gradle.org/distributions/gradle-2.2.1-all.zip
By the time, I was connected on university's network, and this URL was blocked by it's proxy. Since I wasn't able to reach the URL above, all Phonegap could do was to get a corrupted zip file, so that was the reason that exception has been throwed.
Even when I deleted ~/.gradle, I was trying to build on the same network.
So, in order to solve this problem, I have just deleted .gradle directory and run the build using another network connection.