Cordova / Phonegap Android - Java / Ant Issue on build?
Solution 1
Sorry about posting late, I forgot all about this post. I sorted out my issues. I am not sure why I was having issues, but I re-built my Mac, I installed homebrew to manage ant, that solved all my issues.
Solution 2
I solve my problem. On my config.xml I missed the platform tag ir order to configure the icons and splash screen:
<platform name="ios">
</platform>
<platform name="android">
</platform>
Here is the Cordova doc
Maybe you have something misconfigured like me. Hope It helps
Solution 3
Tried my android app on two different Linux machines, the first at work, the second at home. Had the same error at home while it had worked at the office. When I started :
adb logcat
I discovered that, after the .apk upload, my android device rejected it because the signature was different than my previous build.
The solution was dead simple: uninstall the previous version on the device.
Check your device log, error may come from that side !
Solution 4
For me as others might have this problem
I had an old plugin inside the android.json
that I hadn't removed.
So I deleted the android.json
file and then did
phonegap run android
This will rebuild the plugins from what is in your config.xml
Then it worked for me.
user4458505
Updated on July 15, 2020Comments
-
user4458505 almost 4 years
I have been all over this site, so please forgive me if someone else as posted this but I could not find anything that could fix my issue.
I am working on a Mac. With my IOS build, I have no problems at all.
However with Android, I am 'now' having some issues, when I run
cordova build android
I get the following error,/Users/x/Library/Android/sdk/tools/ant/build.xml:601: The following error occurred while executing this line: /Users/x/Library/Android/sdk/tools/ant/build.xml:720: The following error occurred while executing this line: /Users/x/Library/Android/sdk/tools/ant/build.xml:734: Class not found: javac1.8 /Users/x/Desktop/One/platforms/android/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: ant with args: debug,-f,/Users/x/Desktop/test/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen ERROR building one of the platforms: Error: /Users/x/Desktop/test/platforms/android/cordova/build: Command failed with exit code 8 You may not have the required environment or OS to build this project
I use the word 'now' because this error I thought I had fixed and it was working but I have changed nothing with the
PATHS
Any where in my terminal, I can runjavac - version
which gives mejavac 1.8.0_25
. So it can different see java.So I thought Apache Ant might have gone wrong, but when I run
ant -version
I getApache Ant(TM) version 1.9.4 compiled on April 29 2014
- So yes I am running Ant version 1.9.4, which as far as I am aware should work with my java version?So my system can access but java & ant without any issue but I can not build my new Android app. I am now running this in a clean, new (without any plugins or my code) build and still it will not work.
Any help?
Thanks
-
Daniel Aron Goldenberg over 9 years@Harry I found my solution and change the Answer. Thanks for your guidance on last post.
-
Emad Aghaei over 9 yearsTnx Daniel, your solution works for me. but After that my emulator do not shows any thing. in my console the message is "HAX is working and emulator runs in fast virt mode creating window 28 27 320 480 Booting up emulator (this may take a while ......."
-
Dimosthenis Kontogiorgos about 9 yearsThat is not a solution.
-
Dimosthenis Kontogiorgos about 9 yearsAgreed. But you have not narrowed down your solution enough to give sufficient details on how to fix it. We would otherwise rebuild our Mac every time we encountered a problem. :)
-
user4458505 about 9 yearsI was really just saying, I should have installed it on Homebrew to start with, I am really more a Windows user and did not know about it. As from my understanding, it can handle version numbers, therefore easily to control (update/remove) versions.
-
Jamie Hutber almost 9 yearsMy solution will fix the problem without a complete rebuild!
-
whirish almost 9 yearsI had switched from using Ubuntu (where it had worked perfectly) to Windows 8 and uninstalling the app on my phone worked great.
-
raider33 over 8 yearsBig time saver. This is worth trying by everybody since it is so simple.