Search code examples
phonegap-buildphonegaponesignal

Unable to create app: malformed config.xml


Hi try to build my App in Phonegap build, I got the error: Unable to create app: malformed config.xml I have this error since I have added the code for Onesignal notifications Here is my config.xml file

    <?xml version="1.0" encoding="UTF-8" ?>
    <widget xmlns   = "http://www.w3.org/ns/widgets"
        xmlns:gap   = "http://phonegap.com/ns/1.0"
        id          = "My_id"
        versionCode = "10"      
       version     = "1.0.1" > 

    <!-- versionCode is optional and Android only -->
    <plugin name="cordova-plugin-whitelist" source="npm"/>
    <name>MyAppName/name>
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />

    <platform name = 'android'>
        <icon src="icon_V2.png"/> 
    </platform>

    <platform name = 'ios'>
        <icon src='icon_iOS_152x152.png' platform='ios' width='152' height='152' />
        <icon src='icon_iOS_120x120.png' platform='ios' width='120' height='120' />
        <icon src='icon_iOS_76x76.png' platform='ios' width='76' height='76' />
        <icon src='icon_iOS_40x40.png' platform='ios' width='40' height='40' />
    </platform>

        <preference name="orientation"  value="landscape"></preference>
       <preference name="android-minSdkVersion" value="24" /> <!-- For Android version under 8.0-->
    </widget>

<!-- for OneSignal notifications -->
    <gap:plugin name="onesignal-cordova-plugin" spec="^2.4.1" source="npm">
    </gap:plugin>
    <!-- Requires cli-8.0.0 but we recommend using the latest version. -->
    <preference name="phonegap-version" value="cli-8.0.0" />
    <preference name="android-build-tool" value="gradle" />
    <preference name="android-minSdkVersion" value="15" />

I removed the description and the author from the code snipped, it is not relevent here Any Idea Why I have this error


Solution

  • I found it, My xml file contains some errors.. Once you have this message: malformed config.xml . First thing to do is to validate your xml file, use this link: https://www.xmlvalidation.com/ because this error does not specify what is wrong in your file, only the xmlvalidation will tell you Hope this will help.