Cordova没有构建 - Platform Config.xml不正确

时间:2016-08-23 08:22:38

标签: ios cordova build sencha-touch sencha-cmd

我正在使用Cordova 6.3.1。 尝试使用Cordova CLI构建到iOS会产生如下所示的问题。 $ cordova build ios

Error: Pruning at selector "/widget/plugins" from "/Users/path/to/cordova/project/cordova/platforms/ios/Myproj/config.xml" went bad.

更新平台时我也遇到同样的错误:

$ cordova platform update ios

Updating ios project...
iOS project updated with cordova-ios@4.2.1
Error: Pruning at selector "/widget/plugins" from "/Users/path/to/cordova/project/cordova/platforms/ios/Myproj/config.xml" went bad.

1)这个修剪错误究竟是什么意思?

我注意到位于cordova / platforms / ios / Myproj /中的config.xml不包含来自root config.xml的任何信息。它只是默认文件,如下所示:

<widget xmlns     = "http://www.w3.org/ns/widgets"
        id        = "io.cordova.helloCordova"
        version   = "2.0.0">
    <name>HelloCordova</name>

    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>

我的root config.xml文件就像这样开始:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myproj.app" version="1.0.38" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Myproj</name>
    <description>
        Some description.
    </description>

与此同时,当我执行以下操作添加平台时,安装似乎很好:

$ cordova platform add ios

Adding ios project...
Creating Cordova project for the iOS platform:
        Path: ../../../../../desktop/dev/path/to/my/project/cordova/platforms/ios
        Package: com.myproj.app
        Name: Myproj
iOS project created with cordova-ios@4.2.1
Installing "com.mbppower.camerapreview" for ios
Installing "com.phonegap.plugins.PushPlugin" for ios
Installing "cordova-plugin-device" for ios
Installing "cordova-plugin-globalization" for ios
Installing "com.telerik.plugins.healthkit" for ios
Installing "com.transistorsoft.cordova.background-geolocation" for ios
Installing "cordova-plugin-dialogs" for ios
Installing "cordova-plugin-background-fetch" for ios
Installing "cordova-plugin-afnetworking" for ios
Plugin "cordova-plugin-background-fetch" already installed on ios. Making it top-level.
Installing "cordova-plugin-camera" for ios
Installing "cordova-plugin-compat" for ios
Dependent plugin "cordova-plugin-compat" already installed on ios.
Installing "cordova-plugin-console" for ios
Plugin "cordova-plugin-device" already installed on ios. Making it top-level.
Plugin "cordova-plugin-dialogs" already installed on ios. Making it top-level.
Installing "cordova-plugin-file" for ios
Dependent plugin "cordova-plugin-compat" already installed on ios.

The Android Persistent storage location now defaults to "Internal". Please check this plugins README to see if you application needs any changes in its config.xml.

If this is a new application no changes are required.

If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:

      "<preference name="AndroidPersistentFileLocation" value="Compatibility" />"

to config.xml in order for the application to find previously stored files.


Installing "cordova-plugin-file-transfer" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
Installing "cordova-plugin-geolocation" for ios
Dependent plugin "cordova-plugin-compat" already installed on ios.
Dependent plugin "cordova-plugin-globalization" already installed on ios.
Installing "cordova-plugin-http" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
Installing "cordova-plugin-inappbrowser" for ios
Installing "cordova-plugin-media-capture" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
Dependent plugin "cordova-plugin-compat" already installed on ios.
Installing "cordova-plugin-pedometer" for ios
Installing "cordova-plugin-photokandy-video-thumbnail" for ios
Dependent plugin "cordova-plugin-file" already installed on ios.
Installing "cordova-plugin-whitelist" for ios
Installing "phonegap-plugin-barcodescanner" for ios

2)平台安装如何工作?更具体地说,它如何告诉平台特定的config.xml中应该包含哪些内容?

我希望可以在上下文中回答这些问题,以便让我的构建运行。其他一些背景信息:我正在使用Sencha Touch并使用Sencha Cmd构建$sencha app build native,它启动了原始的Cordova项目文件夹。

2 个答案:

答案 0 :(得分:0)

cordova plugins --list 打开x-code找到这些插件 也许cordova插件列表有一些插件,但ios项目不是。

你可以删除它并再次安装 platform > ios > fecth.json or ios.json or package.json 希望有用

抱歉,我不擅长英语。

答案 1 :(得分:0)

对我来说,这篇文章的解决方案得出了解决方案: Cordova pruning error for android config xml

您必须删除所有插件和平台,更新cordova,然后再次添加所有插件和平台。为了清理插件和我的ios平台,我编写了一个npm脚本:

{
    ...
    "rm-plugins": "cordova plugins list | awk '{print $1}' | xargs cordova plugins rm",
    "rm-platforms": "cordova platforms remove ios",
    "cleanup": "npm run rm-platforms && npm run rm-plugins && npm update cordova"
    ...
}

PS:我的错误信息并不完全相同:

Error: Pruning at selector "/*/plugins" from "/Users/Thomas/work/repos/nexboard/iOS/nexboard/platforms/ios/neXboard/config.xml" went bad.