Ant Problem

Hi guys,

I followed the tutorial at these 2 locations :

  1. https://docs.coronalabs.com/native/android/prereqs.html
  • I did the java/brew/ant installation based on this.
  1. https://coronalabs.com/blog/2014/04/01/tutorial-corona-enterprise-quickstart-android/
  • I only tried the sample project. 

Only difference is the Android SDK version. It installed ‘/build-tools/23.0.2’ instead of the ‘/build-tools/21.1.2’.

echo "export PATH=${PATH}:${ANDROID\_SDK}/build-tools/23.0.2" \>\> ~/.bash\_profile

I am getting this error below when sending the ‘ant’ command in Terminal. I tried some solutions online, but the error is the same. I verified that ‘/Library/Java/JavaVirtualMachines/1.6.0.jdk’ exists.

Thanks

ant --execdebug exec "/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java" -classpath "/usr/local/Cellar/ant/1.9.6/lib/ant-launcher.jar" -Dant.home="/usr/local/Cellar/ant/1.9.6" -Dant.library.dir="/usr/local/Cellar/ant/1.9.6/lib" -Djikes.class.path=":/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-rt.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-string.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/charsets.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/classes.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/dt.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/jce.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/jconsole.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/jsse.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/management-agent.jar:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/ui.jar" org.apache.tools.ant.launch.Launcher -cp "" "-lib" "/usr/local/share/ant" Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

ok, it seems that after testing and drilling down the problem, it was due to the ~/base_profile file. To solve it, do not send these commands to the Terminal.

If everything is ok, the ‘ant’ command will return some xml not-found-error .

Hope it helps someone.

echo "export ANT\_HOME=/usr/local/Cellar/ant/X.X.X" \>\> ~/.bash\_profile echo "export PATH=${PATH}:${ANT\_HOME}/bin" \>\> ~/.bash\_profile

For record purposes, here is my bash_profile that works (for me). Note that ‘XXX’ is the username of your mac.

export ANDROID\_SDK=/Users/XXX/Library/Android/sdk export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/tools:/platform-tools:/Users/XXX/Library/Android/sdk/build-tools/21.1.2:/Users/XXX/Library/Android/sdk/tools:/Users/XXX/Library/Android/sdk/platform-tools

ok, it seems that after testing and drilling down the problem, it was due to the ~/base_profile file. To solve it, do not send these commands to the Terminal.

If everything is ok, the ‘ant’ command will return some xml not-found-error .

Hope it helps someone.

echo "export ANT\_HOME=/usr/local/Cellar/ant/X.X.X" \>\> ~/.bash\_profile echo "export PATH=${PATH}:${ANT\_HOME}/bin" \>\> ~/.bash\_profile

For record purposes, here is my bash_profile that works (for me). Note that ‘XXX’ is the username of your mac.

export ANDROID\_SDK=/Users/XXX/Library/Android/sdk export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/tools:/platform-tools:/Users/XXX/Library/Android/sdk/build-tools/21.1.2:/Users/XXX/Library/Android/sdk/tools:/Users/XXX/Library/Android/sdk/platform-tools