Upgrading from Cordova 2.5 to Cordova 3.0 , facing issue while using CordovaInterface

谁说胖子不能爱 提交于 2019-12-01 12:24:59

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!