Error initializing Cordova: Class not found

后端 未结 13 1403
清歌不尽
清歌不尽 2020-12-14 00:09

I followed the tutorial of Phonegap from the official Phonegap.com site (getting started with Android).

I have created project with following all the steps.

13条回答
  •  天涯浪人
    2020-12-14 00:25

    Well,the error I found is:

    05-28 08:19:53.139: E/PluginManager(1478): ===================================================================================== 05-28 08:19:53.139: E/PluginManager(1478): ERROR: config.xml is missing. Add res/xml/config.xml to your project. 05-28 08:19:53.139: E/PluginManager(1478): https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=blob;f=framework/res/xml/plugins.xml

    but I found /res/xml/config.xml in my project

    finally,I found error in org.apache.cordova.api.PluginManager:

    public void loadPlugins() {
    int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml",    this.ctx.getActivity().getClass().getPackage().getName());
    ...
    

    should change to:

    public void loadPlugins() {
    int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml",    this.ctx.getActivity().getPackageName());
    ...
    

    you could read more about the method "getIdentifier(String name, String defType, String defPackage)" in offical doc

提交回复
热议问题