bug: Command failed with exit code 2 You may not have the required environment or OS to build this project
From @shivanshuit914 on March 3, 2015 19:15
Type: bug
Platform: desktop browser
> ionic build ios
ERROR building one of the platforms: Error: /Applications/MAMP/htdocs/myApp/platforms/ios/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project Error: /Applications/MAMP/htdocs/myApp/platforms/ios/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131: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)
OS Mac Maverich, have followed this tutorial http://ionicframework.com/docs/guide/installation.html
Copied from original issue: driftyco/ionic#3225
any solution for that problem ?? This is very major problem. ionic team, any response ?
What should i do here ?
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106)
:dexDebug FAILED
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ':dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/Admin/Downloads/android-sdk-macosx/build-tools/22.0.1/dx --dex --no-optimize --output /Users/Admin/www/picktags.com/public_html/app/platforms/android/build/intermediates/dex/debug --input-list=/Users/Admin/www/picktags.com/public_html/app/platforms/android/build/intermediates/tmp/dex/debug/inputList.txt Error Code: 2 Output:
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106)
-
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: 54.701 secs
/Users/Admin/www/picktags.com/public_html/app/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: /Users/Admin/www/picktags.com/public_html/app/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/Admin/www/picktags.com/public_html/app/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true ERROR running one or more of the platforms: Error: /Users/Admin/www/picktags.com/public_html/app/platforms/android/cordova/run: Command failed with exit code 8 You may not have the required environment or OS to run this project
@assigeo Try this
cd platforms/android/cordova
build.bat --debug
Also make sure your environment variables are correct: This is how my environment (System Vars) looks like and I can build on android.
ADT_HOME = C:\Program Files (x86)\Android\android-sdk
ANT_HOME = C:\apache-ant-1.9.3
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_79
PATH (These should be appended)
%ADT_HOME%\tools;
%ADT_HOME%\platform-tools;
%ANT_HOME%\bin;
Thank you, but my problem didn't solved. So, I decided to install Visual Studio 2015 to do my jod...
I had this issue on OS X Yosemite, with Cordova CLI 5. Downgrading to 4.3.1 fixed it.
i also solved it in that way.
@vasumahesh1 thank you , I solved it in you way
I downgraded my android tools and platform-tools and that solved the problem for me. Here's how I did it: http://stackoverflow.com/questions/9555337/how-to-downgrade-my-sdk-version
No idea if it's a smart answer in the slightest, but it was successful.
I followed this guide and these command lines, and it worked. https://github.com/driftyco/ionic-cli
IOS
update ionic update cordova XCode build - minimum version 4.6.0 ios-sim - min version 3.0.0 (npm install -g ios-sim) ios-deploy - min version 1.2.0 (npm install -g ios-deploy)
For update - http://forum.ionicframework.com/t/how-to-update-the-ionic-in-the-existing-project/2303/7
I am having the same problem with iOS
Cordova CLI: 5.1.1 Ionic Version: 1.0.1 Ionic CLI Version: 1.6.1 Ionic App Lib Version: 0.3.3 ios-deploy version: 1.7.0 ios-sim version: 4.1.1 OS: Mac OS X Yosemite Node Version: v0.12.6 Xcode version: Xcode 6.4 Build version 6E35b
I'm all screwed up after updating cordova version.. to latest "5.1.1".. all my old "ionic" projects are not building now..
I also tried downgrading cordova version to "4.3.1" .. but no luck.. get following error
BUILD FAILED /Users/hiren/Library/android/sdk/tools/ant/build.xml:601: The following error occurred while executing this line: /Users/hiren/Library/android/sdk/tools/ant/build.xml:720: The following error occurred while executing this line: /Users/hiren/Library/android/sdk/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.
Total time: 2 seconds
/Users/hiren/Sites/lpl/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: ant with args: debug,-f,/Users/hiren/Sites/lpl/platforms/android/build.xml ERROR building one of the platforms: Error: /Users/hiren/Sites/lpl/platforms/android/cordova/build: Command failed with exit code 8 You may not have the required environment or OS to build this project Error: /Users/hiren/Sites/lpl/platforms/android/cordova/build: Command failed with exit code 8 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131: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)
ionic info
OS: Mac OS X Yosemite Node Version: v0.10.33 Cordova CLI: 4.3.1 Ionic Version: 1.0.0-rc.0 Ionic CLI Version: 1.3.19 Xcode version: Xcode 6.4 Build version 6E35b ios-sim version: 3.1.1
ios-deploy version: Not installed
I'm trying to build android platform btw..
guyz.. any luck???
:compileDebugJava/var/www/html/project/platforms/android/src/com/plotprojects/cordova/PlotCordovaNotificationOpenReceiver.java:7: error: cannot find symbol import org.apache.cordova.DroidGap; ^ symbol: class DroidGap location: package org.apache.cordova Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 1 error FAILED
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ':compileDebugJava'.
Compilation failed; see the compiler error output for details.
-
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: 42.677 secs
/var/www/html/project/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: /var/www/html/project/platforms/android/gradlew with args: cdvBuildDebug,-b,/var/www/html/project/platforms/android/build.gradle,-Dorg.gradle.daemon=true ERROR building one of the platforms: Error: /var/www/html/fyp/bajaj-mob1.5/platforms/android/cordova/build: Command failed with exit code 1 You may not have the required environment or OS to build this project Error: /var/www/html/project/platforms/android/cordova/build: Command failed with exit code 1 at ChildProcess.whenDone (/root/npm/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134: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)
--> How to fix this error? It come when i try to build ionic project
Any one help me on this issue :
ENOENT, no such file or directory '/Users/isathish/Library/Logs/CoreSimulator/5FC6640B-56FF-4CEE-AB9F-E5622F03BE2B/system.log' Error code 1 for command: ios-sim with args: launch,/Users/isathish/test/platforms/ios/build/emulator/test.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/isathish/test/platforms/ios/cordova/console.log,--stdout,/Users/isathish/test/platforms/ios/cordova/console.log,--exit ERROR running one or more of the platforms: Error: /Users/isathish/test/platforms/ios/cordova/run: Command failed with exit code 2 You may not have the required environment or OS to run this project
I had the same issue, it was being thrown by a plugin. The plugin name was right before ** BUILD FAILED **. I remove it an it solved the problem - luckily we had just stopped using it anyway.
i resolved this issue :+1:
Quick Solution : -
step 1: - Create new user account in your Mac Pro. step 2: - Install the ionic and cordova Step 3 :- Download new android studio and xcode software
Now you can run ionic it will work.
I was running into same problem. I had been messing with the configs. I ran ionic state reset and it did the trick.
ionic info
Your system information:
Cordova CLI: 5.1.1 Gulp version: CLI version 3.9.0 Gulp local: Local version 3.9.0 Ionic Version: 1.1.0 Ionic CLI Version: 1.6.4 Ionic App Lib Version: 0.3.8 ios-deploy version: Not installed ios-sim version: Not installed OS: Mac OS X Mavericks Node Version: v0.12.7 Xcode version: Xcode 6.2 Build version 6C131e
ionic build android --debug Running command: /Users/bedoae/Documents/ionic/X-Tust/hooks/after_prepare/010_add_platform_class.js /Users/bedoae/Documents/ionic/X-Tust add to body class: platform-android Running command: /Users/bedoae/Documents/ionic/X-Tust/platforms/android/cordova/build --debug ANDROID_HOME=/Applications/android-sdk-macosx JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home Running: /Users/bedoae/Documents/ionic/X-Tust/platforms/android/gradlew cdvBuildDebug -b /Users/bedoae/Documents/ionic/X-Tust/platforms/android/build.gradle -Dorg.gradle.daemon=true :preBuild :compileDebugNdk UP-TO-DATE :preDebugBuild :checkDebugManifest :CordovaLib:compileLint :CordovaLib:copyDebugLint UP-TO-DATE :CordovaLib:mergeDebugProguardFiles UP-TO-DATE :CordovaLib:preBuild :CordovaLib:preDebugBuild :CordovaLib:checkDebugManifest :CordovaLib:prepareDebugDependencies :CordovaLib:compileDebugAidl UP-TO-DATE :CordovaLib:compileDebugRenderscript UP-TO-DATE :CordovaLib:generateDebugBuildConfig UP-TO-DATE :CordovaLib:generateDebugAssets UP-TO-DATE :CordovaLib:mergeDebugAssets UP-TO-DATE :CordovaLib:generateDebugResValues UP-TO-DATE :CordovaLib:generateDebugResources UP-TO-DATE :CordovaLib:packageDebugResources UP-TO-DATE :CordovaLib:processDebugManifest UP-TO-DATE :CordovaLib:processDebugResources UP-TO-DATE :CordovaLib:generateDebugSources UP-TO-DATE :CordovaLib:compileDebugJava UP-TO-DATE :CordovaLib:processDebugJavaRes UP-TO-DATE :CordovaLib:packageDebugJar UP-TO-DATE :CordovaLib:compileDebugNdk UP-TO-DATE :CordovaLib:packageDebugJniLibs UP-TO-DATE :CordovaLib:packageDebugLocalJar UP-TO-DATE :CordovaLib:packageDebugRenderscript UP-TO-DATE :CordovaLib:bundleDebug UP-TO-DATE :prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE :preReleaseBuild :CordovaLib:copyReleaseLint UP-TO-DATE :CordovaLib:mergeReleaseProguardFiles UP-TO-DATE :CordovaLib:preReleaseBuild :CordovaLib:checkReleaseManifest :CordovaLib:prepareReleaseDependencies :CordovaLib:compileReleaseAidl UP-TO-DATE :CordovaLib:compileReleaseRenderscript UP-TO-DATE :CordovaLib:generateReleaseBuildConfig UP-TO-DATE :CordovaLib:generateReleaseAssets UP-TO-DATE :CordovaLib:mergeReleaseAssets UP-TO-DATE :CordovaLib:generateReleaseResValues UP-TO-DATE :CordovaLib:generateReleaseResources UP-TO-DATE :CordovaLib:packageReleaseResources UP-TO-DATE :CordovaLib:processReleaseManifest UP-TO-DATE :CordovaLib:processReleaseResources UP-TO-DATE :CordovaLib:generateReleaseSources UP-TO-DATE :CordovaLib:compileReleaseJava UP-TO-DATE :CordovaLib:processReleaseJavaRes UP-TO-DATE :CordovaLib:packageReleaseJar UP-TO-DATE :CordovaLib:compileReleaseNdk UP-TO-DATE :CordovaLib:packageReleaseJniLibs UP-TO-DATE :CordovaLib:packageReleaseLocalJar UP-TO-DATE :CordovaLib:packageReleaseRenderscript UP-TO-DATE :CordovaLib:bundleRelease UP-TO-DATE :prepareComAndroidSupportSupportV42220Library UP-TO-DATE :prepareDebugDependencies :compileDebugAidl UP-TO-DATE :compileDebugRenderscript UP-TO-DATE :generateDebugBuildConfig UP-TO-DATE :generateDebugAssets UP-TO-DATE :mergeDebugAssets UP-TO-DATE :generateDebugResValues UP-TO-DATE :generateDebugResources UP-TO-DATE :mergeDebugResources UP-TO-DATE :processDebugManifest UP-TO-DATE :processDebugResources UP-TO-DATE :generateDebugSources UP-TO-DATE :compileDebugJava UP-TO-DATE :preDexDebug UP-TO-DATE :dexDebug UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106)
FAILED
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ':dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/android-sdk-macosx/build-tools/21.1.2/dx --dex --no-optimize --output /Users/bedoae/Documents/ionic/X-Tust/platforms/android/build/intermediates/dex/debug --input-list=/Users/bedoae/Documents/ionic/X-Tust/platforms/android/build/intermediates/tmp/dex/debug/inputList.txt Error Code: 2 Output:
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106)
-
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: 1 mins 51.899 secs
/Users/bedoae/Documents/ionic/X-Tust/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: /Users/bedoae/Documents/ionic/X-Tust/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/bedoae/Documents/ionic/X-Tust/platforms/android/build.gradle,-Dorg.gradle.daemon=true ERROR building one of the platforms: Error: /Users/bedoae/Documents/ionic/X-Tust/platforms/android/cordova/build: Command failed with exit code 1 You may not have the required environment or OS to build this project Error: /Users/bedoae/Documents/ionic/X-Tust/platforms/android/cordova/build: Command failed with exit code 1 at ChildProcess.whenDone (/usr/local/Cellar/node/0.12.7/libexec/npm/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134: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)
Hope this helps someone. I had an error
:processDebugResources/Volumes/SSD/Sites/ionic/_______/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml:24: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/icon').
The issue was that running the icon generating command (ionic resources --icon) as specified here http://ionicframework.com/docs/cli/icon-splashscreen.html didn't take my icon.psd and generate the correct icon files for android. It did work after using a PNG (icon.png) instead of a PSD.
Hi All,
I have a problem when run ionic build android The message is like this: Running command: /Users/Arno/conference/hooks/after_prepare/010_add_platform_class.js /Users/Arno/conference add to body class: platform-android Running command: /Users/Arno/conference/platforms/android/cordova/build ANDROID_HOME=/Users/Arno/android-sdk-macosx JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home Running: /Users/Arno/conference/platforms/android/gradlew cdvBuildDebug -b /Users/Arno/conference/platforms/android/build.gradle -Dorg.gradle.daemon=true :preBuild :compileDebugNdk UP-TO-DATE :preDebugBuild :checkDebugManifest :CordovaLib:compileLint :CordovaLib:copyDebugLint UP-TO-DATE :CordovaLib:mergeDebugProguardFiles UP-TO-DATE :CordovaLib:preBuild :CordovaLib:preDebugBuild :CordovaLib:checkDebugManifest :CordovaLib:prepareDebugDependencies :CordovaLib:compileDebugAidl UP-TO-DATE :CordovaLib:compileDebugRenderscript UP-TO-DATE :CordovaLib:generateDebugBuildConfig UP-TO-DATE :CordovaLib:generateDebugAssets UP-TO-DATE :CordovaLib:mergeDebugAssets UP-TO-DATE :CordovaLib:generateDebugResValues UP-TO-DATE :CordovaLib:generateDebugResources UP-TO-DATE :CordovaLib:packageDebugResources UP-TO-DATE :CordovaLib:processDebugManifest UP-TO-DATE :CordovaLib:processDebugResources FAILED
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ':CordovaLib:processDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/Arno/android-sdk-macosx/build-tools/23.0.0/aapt package -f --no-crunch -I /Users/Arno/android-sdk-macosx/platforms/android-22/android.jar -M /Users/Arno/conference/platforms/android/CordovaLib/build/intermediates/bundles/debug/AndroidManifest.xml -S /Users/Arno/conference/platforms/android/CordovaLib/build/intermediates/bundles/debug/res -A /Users/Arno/conference/platforms/android/CordovaLib/build/intermediates/bundles/debug/assets -m -J /Users/Arno/conference/platforms/android/CordovaLib/build/generated/source/r/debug --debug-mode --custom-package org.apache.cordova --non-constant-id -0 apk --output-text-symbols /Users/Arno/conference/platforms/android/CordovaLib/build/intermediates/bundles/debug Error Code: 139
-
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: 5 mins 13.588 secs
/Users/Arno/conference/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: /Users/Arno/conference/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/Arno/conference/platforms/android/build.gradle,-Dorg.gradle.daemon=true ERROR building one of the platforms: Error: /Users/Arno/conference/platforms/android/cordova/build: Command failed with exit code 1 You may not have the required environment or OS to build this project Error: /Users/Arno/conference/platforms/android/cordova/build: Command failed with exit code 1 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/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)
this error frustrating me. I can't figure out what happen. please help me out.
If you have run the command ionic resources and have not put in the correct resources in the appropriate directories (as per the instructions), then you can get this error, as the source files will be missing.
I did the following:
- Remove icons and splash screen settings from
config.xml - Run the following:
ionic platform remove android
ionic platform add android --noresources
This seemed to get rid of the issue by forcing the platform to be created without any ionic resources.
hi, i've try your suggestion but the error still occur. Is that any library or something that accidentally not installed on my mac?
There is no error while building for ios platform.