When I run cordova build android I had error.
exit /b 1 Command finished with error code 1:\platforms\android\gradlew cdvBuildDebug,-b,myprodplatforms\android\build.gradle myprodplatforms\android\gradlew: Command failed with exit code 1 Error output: Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at
org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63) Error: myprodplatforms\android\gradlew: Command failed with exit code 1 Error output: Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
at ChildProcess.whenDone (myprodnode_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:210:5)
at ChildProcess.cp.emit (myprodnode_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) [ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --verbose exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I tried to remove and add android remove node modules, I updated node module to latest version .
Can someone give me idea how to solved error.
Ivan, One thing seems typo, the command is ionic cordova build android, you have mentioned only cordova build android command, ionic is missing.
It seems your error is more related to Android Studio/Gradle installation not related to node module or ionic. still as per error mentioned which itself suggests please run build command with --verbose flag as below.
ionic cordova build android --verbose
the --verbose flag may help you to give exact Gradle or specific component associated error, which can further help you to reach to the specific root cause.
Please run ionic cordova build android instead of cordova build android to get APK and run ionic cordova build ios to get IPA
Related
I'm facing some issue compiling an app in Cordova.
Basically after a Windows re-installation I re-istalled Android Studio, NPM and Cordova but when I try to run an application (I tried with the application I was working on before the OS re-installation and even with the "basic" Cordova app) Cordova give me "Exception in thread "main" java.lang.NullPointerException" (rest of the error below).
I've installed Gradle manually "C:\src\gradle-5.6" and set the environment variable (before Windows re-istallation I didn't installed it manually and it was working) and tried even to download and configure via env. varible the same version on the
\platforms\android\cordova\lib\builders\ProjectBuilder.js file, which is 4.10.3 but still the same error.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\william.manzato\AppData\Local\Android\Sdk\
(recommended setting)
ANDROID_HOME=C:\Users\william.manzato\AppData\Local\Android\Sdk\
(DEPRECATED) Subproject Path: CordovaLib Subproject Path: app
Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
C:\Users\william.manzato\Wamp\NCR Error Codes
Translator\platforms\android\gradlew: Command failed with exit code 1
Error output: Exception in thread "main"
java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Did anyone else faced this issue and managed to solve it?
I reply by myself to this in case someone faces the same issue.
I just downgrade java (JRE and JDK) from 221 to 212, rebooted the pc et voilá, it works again.
I'm dying trying to figure this out!
Essentially, I've finished up an Ionic app and am ready to publish it to the Google Play Store. The problem is that I'm having trouble following the directions posted on the Ionic Framework website.
So far, I've created an 'android' folder under 'platforms'.
Error thrown:
Android Studio project detected
ANDROID_HOME=C:\Users\fromf\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\java\jdk1.8.0_191
studio
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
(node:43720) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
My various attempts:
Firstly, that I cannot seem to find the 'build' folder referenced at 'platforms/android/build/outputs/apk'. It simply does not exist.
Having recognised that I'm lacking the 'build' folder, I attempted to change the environment variables according to this website: http://www.tiagoporto.com/blog/environment-setting-tutorial-ionic-android-on-windows/. This did not work.
I followed the directions given on various SoF Q&As, and manually downloaded the needed gradle, called "gradle-2.2.1-all.zip". Still did not work.
I am at my wits ends. Please please please help!
I'm using cordova 6.4.0 with node 6.9.4. I have android studio installed in my PC (windows) with SDK 23,24,25 and ANDROID_HOME, ANDROID_NDK_HOME, ANT_HOME, JAVA_HOME in my system variable. After creating a new project using cordova and then trying to add android platform I'm getting following error:
E:\Android\q>cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: io.cordova.hellocordova
Name: HelloCordova
Activity: MainActivity
Android target: android-24
Subproject Path: CordovaLib
Android project created with cordova-android#6.0.0
Installing "cordova-plugin-whitelist" for android
ANDROID_HOME=C:\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Subproject Path: CordovaLib
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> java.lang.NullPointerException (no error message)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 8.891 secs
Failed to install 'cordova-plugin-whitelist':Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (E:\Android\q\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: cmd: Command failed with exit code 1
I uninstalled JAVA(JDK,JRE), Andorid Studio, Cordova CLI and reinstalled them. After that I'm getting same error. I tried removing whitelist plugin and it throw build error with exit code 1. How to solve this ?
I have been trying to setup run my first react native project and have followed the steps provided here. But i keep getting this error when i run
$ react-native run-android
what i get is this
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Unzipping /home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4-all.zip to /home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0
Exception in thread "main" 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:159)
at org.gradle.wrapper.Install.access$500(Install.java:26)
at org.gradle.wrapper.Install$1.call(Install.java:69)
at org.gradle.wrapper.Install$1.call(Install.java:46)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:46)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
I have searched and all i have seen so far are genymotion user solutions.
Any idea on how to fix this?
Oh, i found the error, the zip file in
/home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4-all.zip
was corrupt that's y it could not be unzipped by the java.
So I have to go into the folder and delete the zip file mannualy and then run
react-native run-android
again. Hope that helps someone else. This is usually due to internet connection issues.
Set your ANDROID_HOME environment variables. Check your adb devices first. If your device is available. See the cyprusglobe suggestion.
Run:
- chmod 755 android/gradlew
- react-native run-android
I'm having an issue that's taking me since yesterday morning to figure it out with no success. I'm really desperate right now to solve this.
In the log console, at the bottom of the Android-Studio window I get this error:
Error: Gradle: Execution failed for task':MyApplication2:mergeDebugResources'.
>java.io.IOException: Cannot run program "/home/user/.local/android-studio/sdk/build-tools/android-4.2.2/aapt": error=2, No such file or directory
But happens that the file is there. I've done some research with no success. I'm taking so much time on this. I don't know why this should be wrong. I'm on Linux.
Please help me resolving this issue.
EDIT:
On Processing IDE the exact same error happens:
BUILD FAILED
/home/user/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:
/home/user/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml:690: Execute failed: java.io.IOException: Cannot run program "/home/user/adt-bundle-linux-x86_64-20130729/sdk/build-tools/18.0.1/aapt" (in directory "/tmp/android8933435574063638939sketch"): java.io.IOException: error=2, No such file or directory
Try to install the following:
sudo apt-get --no-install-recommends install ia32-libs-multiarch