I am migrating my project to Cordova 3 from Cordova 2.5. Followed the migration process mentioned in
http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html
But, unfortunately getting the following error
Preparing android project [Error: No Java files found which extend
CordovaActivity.]
In our app, we have a class which extends activity and implements CordovaInterface. And moreover this class is in the location mentioned in config.xml.
Yet, I am facing the following error. Is it mandatory to substitute CordovaInterface with CordovaActivity? I am pretty sure that will not be the mandatory case.
This is causes by a bonehead, broken, Cordova build system.
If you simply add any old class in your source tree, next to your activity, that extends CordovaActivity, the build will work.
You don't even have to use the class, just make one.
It's like they are having an internal debate about how it should work, and one side screwed over the other by making the build fail if they didn't get their way.
Example:
import org.apache.cordova.CordovaActivity;
/**
* This class is simply here to make sure Cordova will build. Without it, even
* though it's not used or otherwise referenced, you will get a build error that
* looks like "Error: No Java files found which extend CordovaActivity".
*
* This applies as of Cordova 3.5.0. It should be re-tested when upgrading to
* Cordova 4.x.
*
*/
public class FakeCordovaActivityForBuild extends CordovaActivity {
}
With luck, someone on the dev team will notice this little conflict and fix it, I suppose it should be listed as a bug in their system, but I have not added it.
Interestingly, replacing CordovaInterface with the CordovaActivty (and appropriate changes) resolved the issue. There is no mention of mandatory usage of CordovaActivity in release notes documentation.
However, need to refine code inside the Java file which extends CordovaActivity.