Failed to create Android project on Mac OS

I am new to the phone. I created a project for the entire platform on Mac OS. I can create other than the Android platform. I am using cordova version 5.1.1.

cordova build android

 cordova build android Running command: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/cordova/build ANDROID_HOME=/Users/abc/Library/Android/sdk/ JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home Running: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/gradlew cdvBuildDebug -b /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/build.gradle -Dorg.gradle.daemon=true > Configuring > 0/2 projects > root project > Resolving dependencies ':classpath' FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:1.0.0+. Required by: :android:unspecified > Failed to list versions for com.android.tools.build:gradle. > Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml. > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml'. > Malformed reply from SOCKS server * 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 6.688 secs /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/platforms/android/build.gradle,-Dorg.gradle.daemon=true ERROR building one of the platforms: Error: /Users/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/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/abc/AndroidDevelopments/Project/abcDemo/abcDemo1.1/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:134:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:753:16) at Process.ChildProcess._handle.onexit (child_process.js:820:5) 
+6
source share
2 answers

If you want to use the local maven repo instead of the remote, you need to add jar files to the local repository.

The maven local repository is in

~ / .m2 / repository

You can download it from this link, http://mvnrepository.com/artifact/com.android.tools.build/builder/

To install this type of library on the command line:

mvn install: install-file -DgroupId = com.android.tools.build \ -DartifactId = builder \ -Dversion = 0.5.4 \ -Dfile = builder-0.5.4.jar \ -Dpackaging = jar \ -DgeneratePom = true

Then in the build.gradle file change the file,

mavenCentral ()

to

mavenLocal ()

This can help:)

0
source

Setting up the Android SDK path for me was junk.

Try the following:

  • Download and install Android Studio
  • Install the required API
  • Open Android Studio and go to the tab "Settings" → "Default project" → "Project structure"

There you will find ways for the SDK. From here you can go to this link http://docs.phonegap.com/en/4.0.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide

Basically, you should add the path to the SDK and Android tools to your .bash_profile. COPY and PASTE step 3 forms the path to the bash file.

So...

  1. Open a terminal and run this command source ~/.bash_profile , this will create a .bash file in the user's root directory
  2. Open the .bash_profile file (it will be hidden, so you may need to do this to make hidden files visible. In the terminal, execute defaults write com.apple.finder AppleShowAllFiles YES )
  3. Edit the bash_profile file using the text editing tool as shown in the link above.

Good luck

0
source

All Articles