Unable to resolve org.apache.cordova (Mac)


#1

I can’t seem to build my ionic project for the android platform. Everything works perfectly for IOS. I’ve reinstalled node, ionic, cordova several times, I’ve made sure I’m using the absolute most recent version of ANT and the adt-bundle, my build target is 18. I have spent hours and hours trying to figure this out without needing to post a question. I’ve looked for others with this issue as well.

Other things I’ve done, I’ve made sure my path was set correctly to see the tools and platform-tools directories. I’m almost tempted to just get the zipped copy of cordova and set it up using that route, but I don’t think I should have to do that, if its going to be as easy as the directions say.

As a sanity check, I’ve imported the android project created into ADT, where I’m clearly seeing the code issue. Others who don’t use Ionic, typically have some cordova jar file built and they use that to include with their Android code, but I think with Ionic, I should have a cordovaLib directory that has this jar file - this isn’t being created.

Weeks ago, I had no issues, so maybe something broke in a recent update with Cordova…

What can I do, have org.apache.cordova seen, so that my projects can be built?


#2

could you post the error messages you get?

Have you tried API level 19? (just to ensure nothing is broken in android API level 18)


#3

I’m sorry, i actually am using level 19.

So to solve the problem, I rolled Cordova back to a previous version. There is definitely an issue with Ant not able to build anything related to the CordovaLib directroy (when doing an Android build) with the most recent versions of Cordova. It doesn’t make a difference if you try building only with Cordova, or with Phonegap - its the same error from Ant not able to find Cordova - its a “symbol not found” error.

I tried going to a previous version of Ant which did not fix the issue, so I’m back to 1.9.4.

Anyway, I know Cordova worked last month, when building for Android, with no problems, and that directory was built, so I finally decided to just roll back to a version I might have used a month ago. Now all these new people are trying to use it, with Android and having problems. There’s posts about this in various forums.

Currently, Cordova 3.3.1-0.4.2 works - dated 2-14-2014. There’s 10 more updates after this, so I’ll try each one till it breaks, and post my results here.


#4

[TROUBLESHOOTING DIFFERENT VERSIONS]

3.4.1-0.1.0 - After my success in the previous post,I deleted CordovaLib from the platfiorms/Android directory. Cordova was unable to rebuild it - works if it already exists (which may be why they didn’t catch this bug - it affects brand new projects).

3.2.0-0.4.0 - does not build (note - seemed to have alot of plugins included)

3.3.1-0.4.2 - works if you start with a fresh new folder - you can’t just ugrade, you have to start fresh and copy your app files back in

3.5.0-0.2.4 (latest) - fails on a clean build

3.5.0-0.2.1 - fails on clean build

3.4.1-0.1.0 - fails on clean build

3.4.0-0.1.3 - fails on clean build

3.4.0-0.1.0 - fails on clean build

3.4.0-rc.2 - could not install via npm - its gone…

3.3.1-0.4.23.3.1-0.4.2 - SUCCESS! WORKS

now to jump ahead and upgrade cordova to latest and try rebuilding on top of old project with CordovaLib already built:

3.5.0-0.2.4 - the latest!

Rebuilds, but output different - no line breaks in the output, but it works. There seems to be alot of operations different than the early version - like a degug.apk being created.

To recap I did this to fix it [ATTENTION: BAND-AID SOLUTION FOLLOWS]:

Install old version of cordova from February, 2014

sudo npm -g uninstall cordova

sudo npm -g install cordova@3.3.1-0.4.2

delete previous project

rm -Rf wishthisworked

cordova create wishthisworked

cordova platform add android

cordova build android

  • DONE with old version, now to install the latest version

sudo npm -g uninstall cordova

sudo npm -g install cordova@3.5.0-0.2.4

within directory, build again - WORKS

Going forward :

Cordova needs to fix this bug. I’ll report my findings to them.

The bad thing is every new project won’t build for Android, without first uninstalling the new version of Cordova and going back to the old version from Feb, 2014, or try copying the CordovaLib directory to the platform/android directory - but that is stupid … We shouldn’t have to do this… (I have not tested this by the way)

So there’s definitely a bug, it shouldn’t be this hard. And even if its an issue with my environment when all is said and done, it would be REAL NICE to have some code in the setup that checks for that and tells the user/installer. Otherwise, I have to dig into this more to find out why Ant is broke, and I don’t have time for that. I can just do my app in native Android and Xcode faster than fixing this issue.