No Cordova platforms listed in config.xml

Which means you probably have an old Cordova version and should upgrade to 7.0.1 @Pichonic Possible?

No problem, glad the issue is resolved.

Regards,
Neonic1

Try this

ionic cordova platform save

It works for meā€¦

I also encountered this problem today and I fixed it by editing my platforms.json under your platforms folder.

{
    "android": "6.2.3"
}

I also have been experiencing this issue.

The iOS platform is installed:

cordova platform ls
āœ” Running command - done!
Installed platforms:
  android 6.2.3
  ios 4.4.0
Available platforms:
  blackberry10 ~3.8.0 (deprecated)
  browser ~4.1.0
  osx ~4.0.1
  webos ~3.7.0

If I run (with ionic prefix):

ionic cordova prepare
[WARN] No Cordova platforms listed in config.xml. Nothing to prepare.
You can save your installed platforms to config.xml with the ionic cordova platform save command.

However if I run it without the ionic prefix it works.

If I follow the instructions about saving the platform I get:

ionic cordova prepare
[WARN] No Cordova platforms listed in config.xml. Nothing to prepare.

       You can save your installed platforms to config.xml with the ionic cordova platform save command.
Bens-MacBook-Pro-4:kpmg-events-mobile ben$ ionic cordova platform save
> cordova platform save
āœ” Running command - done!

ā€¦ and then run prepare again it still says there is no platform (when using the ionic prefix):

ionic cordova prepare
[WARN] No Cordova platforms listed in config.xml. Nothing to prepare.
You can save your installed platforms to config.xml with the ionic cordova platform save command.

ā€¦ again, without the ionic prefix it all works:

Here are the versions I am running:

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1
    Gulp CLI    : CLI version 3.9.1 Local version 3.9.1

local packages:

    Cordova Platforms : android 6.2.3 ios 4.4.0
    Ionic Framework   : ionic1 1.2.4

System:

    Android SDK Tools : 26.0.2
    ios-deploy        : 1.9.1
    Node              : v6.11.1
    npm               : 3.10.10
    OS                : macOS Sierra
    Xcode             : Xcode 8.3.3 Build version 8E3004b

I have all the same problems with ionic upload:

ionic upload --deploy=production --note="500.0.7"
> ionic cordova prepare
[WARN] No Cordova platforms listed in config.xml. Nothing to prepare.
You can save your installed platforms to config.xml with the ionic cordova platform save command.

My config looks good as far as I can tell:

<?xml version='1.0' encoding='utf-8'?>
<widget id="###SECRET###" version="500.0.7" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>### SECRET###</name>
    <description>
    	###SECRET###
  </description>
    <author email="studio@contra.agency" href="http://contra.agency">
		###SECRET###
	</author>
    <content src="index.html" />
    <access launch-external="yes" origin="tel:*" />
    <access launch-external="yes" origin="mailto:*" />
    <access launch-external="yes" origin="maps:*" />
    <allow-navigation href="http://localhost:8080/*" />
    <allow-intent href="tel:*" />
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="16" />
    <preference name="android-targetSdkVersion" value="23" />
    <preference name="BackupWebStorage" value="none" />
    <preference name="SplashScreen" value="screen" />
    <preference name="AutoHideSplashScreen" value="ture" />
    <preference name="SplashScreenDelay" value="4000" />
    <preference name="ShowSplashScreenSpinner" value="false" />
    <preference name="FadeSplashScreen" value="true" />
    <preference name="FadeSplashScreenDuration" value="2000" />
    <preference name="StatusBarOverlaysWebView" value="true" />
    <preference name="StatusBarStyle" value="lightcontent" />
    <preference name="Orientation" value="portrait" />
    <preference name="windows-target-version" value="10.0" />
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar" />
    </feature>
    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />
    </feature>
    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
    <preference name="AndroidLaunchMode" value="singleTask" />
    <platform name="ios">
        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
        <splash src="resources/ios/screen/Default@2x~universal~anyany.png" />
        <preference name="ios-XCBuildConfiguration-CODE\_SIGN\_IDENTITY" value="iPhone Developer" />
        <config-file mode="replace" parent="UISupportedInterfaceOrientations" platform="ios" target="*-Info.plist">
            <array>
                <string>UIInterfaceOrientationPortrait</string>
            </array>
        </config-file>
        <config-file mode="replace" parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
            <string>Allows the taking and uploading of photos to the messaging channel</string>
        </config-file>
        <config-file mode="replace" parent="NSPhotoLibraryUsageDescription" platform="ios" target="*-Info.plist">
            <string>Allows the taking and uploading of photos to the messaging channel</string>
        </config-file>
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
    </platform>
    <platform name="android">
        <icon src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
    </platform>
    <vs:toolsetVersion xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps">6.3.1</vs:toolsetVersion>
    <preference name="SplashShowOnlyFirstTime" value="false" />
    <plugin name="cordova-custom-config" spec="^4.0.2" />
    <plugin name="cordova-plugin-buildinfo" spec="~1.1.0" />
    <plugin name="cordova-plugin-camera" spec="^2.4.1">
        <variable name="CAMERA_USAGE_DESCRIPTION" value="Allow the upload of images to the messaging channel." />
        <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="Allow the upload of images to the messaging channel." />
    </plugin>
    <plugin name="cordova-plugin-console" spec="~1.0.6" />
    <plugin name="cordova-plugin-crosswalk-webview" spec="^2.3.0">
        <variable name="XWALK_VERSION" value="23+" />
        <variable name="XWALK_LITEVERSION" value="xwalk_core_library_canary:17+" />
        <variable name="XWALK_COMMANDLINE" value="--disable-pull-to-refresh-effect" />
        <variable name="XWALK_MODE" value="embedded" />
        <variable name="XWALK_MULTIPLEAPK" value="true" />
    </plugin>
    <plugin name="cordova-plugin-device" spec="~1.1.5" />
    <plugin name="cordova-plugin-disable-ios11-statusbar" spec="^1.0.0" />
    <plugin name="cordova-plugin-email-composer" spec="git+https://github.com/katzer/cordova-plugin-email-composer.git" />
    <plugin name="cordova-plugin-fcm" spec="^2.1.2" />
    <plugin name="cordova-plugin-inappbrowser" spec="1.2.1" />
    <plugin name="cordova-plugin-network-information" spec="~1.2.0" />
    <plugin name="cordova-plugin-queries-schemes" spec="^0.1.5" />
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.2" />
    <plugin name="cordova-plugin-statusbar" spec="~2.2.2" />
    <plugin name="cordova-plugin-whitelist" spec="1.2.2" />
    <plugin name="cordova-plugin-wkwebview-engine" spec="git+https://github.com/ionic-team/cordova-plugin-wkwebview-engine.git" />
    <plugin name="cordova-plugin-x-socialsharing" spec="^5.2.0" />
    <plugin name="de.appplant.cordova.plugin.local-notification" spec="git+https://github.com/katzer/cordova-plugin-local-notifications.git#ios10" />
    <plugin name="ionic-plugin-deeplinks" spec="^1.0.15">
        <variable name="URL_SCHEME" value="###SECRET###" />
        <variable name="DEEPLINK_SCHEME" value="https" />
        <variable name="DEEPLINK_HOST" value="###SECRET###" />
        <variable name="ANDROID_PATH_PREFIX" value="/" />
        <variable name="ANDROID_2_PATH_PREFIX" value="/" />
        <variable name="DEEPLINK_2_SCHEME" value="https" />
        <variable name="DEEPLINK_2_HOST" value="###SECRET###" />
    </plugin>
    <plugin name="ionic-plugin-deploy" spec="^0.4.1" />
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
</widget>

I have removed and added the platform countless times. No avail.

NOTE: My platforms.json file in the platform folder is empty. This is likely the cause of the issue. It isnā€™t being updated.

1 Like

I have fixed the issueā€¦

I realised the file platforms/platforms.json was empty. I edited it to:

{
    "ios": "4.4.0",
    "android": "6.2.3"
}

Then ran:

$ ionic cordova platform save

After that it all workedā€¦ :slight_smile:

2 Likes

I concur this fixed my issue alsoā€¦ I had to run:

$ ionic cordova platform save

after editing the platform.json before it all started to work.

i try to do that its work fin for me

sudo npm update -g cordova
sudo npm update -g ionic

rm -rf plugins/ platforms/

ionic platform add ios
ionic run ios

place this command in config.xml It worked for me

<engine name = ""android spec = ā€œ^8.0.0ā€/>

1 Like

This happened me when I changed my bundle ID.

  1. changed bundle ID
  2. Removed and re added platforms
  3. ionic cordova platform save

And I got that error, not cordova platforms listed in config.xml.

I noticed from looking back at changes in Github that like @benedge, platforms was now empty.
Also,

<engine name="android" spec="^7.1.4" />
    <engine name="ios" spec="4.5.5" />

Had been removed from config.xml.

So, I just copy and pasted them back in from the changes in the Github history, ran ionic cordova platform save and all is well again. I can build APKā€™s.

Well, relatively well. I canā€™t use ionic cordova run android --livereload anymore as I get the same error as this guy: https://stackoverflow.com/questions/57800300/run-android-livereload-err-invalid-response

This error doesnā€™t appear when I build it out and run the apk on my phone though :thinking: