5 Replies Latest reply on Aug 10, 2017 12:50 PM by simon.macdonald

    add plugins from config.xml

    BigLittle8712 Level 1

      So I migrated from PG Build to desktop because it doesn't support hooks. Now I'm using Phonegap CLI 6.5.2 and I want to install all plugins under my config.xml from the PGB project. Currently, I have to manually add them with the terminal. I did this on a Mac and now I have to do this on Windows machine. It's too tedious considering they're all listed in config.xml already with all the variables.

       

      A few times when I created a new project, and then used "phonegap serve" immediately it downloaded all the plugins, but if I use my config.xml the plugins folder remains empty. Not even core plugins are downloaded except for cordova-plugin-whitelist.

        • 1. Re: add plugins from config.xml
          simon.macdonald Adobe Employee

          The prepare stage of the build should automatically download the plugins in config.xml. Can you post what your config.xml looks like?

          • 2. Re: add plugins from config.xml
            BigLittle8712 Level 1

            The config.xml is a bit of a mess, but it should still work. It works for PGB.

             

            The config.xml is in the project root and a copy in the www folder. They're the same except for the icon paths.

             

            <?xml version='1.0' encoding='utf-8'?>

            <widget id="com.example.app" version="4.7.1" versionCode="7950" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:gap="http://phonegap.com/ns/1.0">

                <name>App Name</name>

                <description>

                   App Desc

                </description>

                <author email="support@example.com" href="http://www.example.com">

                    App Name

                </author>

                <preference name="permissions" value="none" />

                <preference name="orientation" value="portrait" />

                <preference name="target-device" value="universal" />

                <preference name="fullscreen" value="false" />

                <preference name="webviewbounce" value="false" />

                <preference name="prerendered-icon" value="false" />

                <preference name="stay-in-webview" value="false" />

                <preference name="detect-data-types" value="false" />

                <preference name="exit-on-suspend" value="false" />

                <preference name="show-splash-screen-spinner" value="false" />

                <preference name="auto-hide-splash-screen" value="false" />

                <preference name="disable-cursor" value="false" />

                <preference name="android-installLocation" value="auto" />

                <preference name="android-minSdkVersion" value="14" />

                <preference name="android-targetSdkVersion" value="21" />

                <preference name="android-windowSoftInputMode" value="stateUnchanged|adjustResize" />

                <icon src="www/icon.png" />

                <platform name="ios">

                    <icon height="180" src="www/img/icons/pp_icon_square_fw-180.png" width="180" />

                    <icon height="60" src="www/img/icons/pp_icon_square_fw-60.png" width="60" />

                    <icon height="120" src="www/img/icons/pp_icon_square_fw-120.png" width="120" />

                    <icon height="76" src="www/img/icons/pp_icon_square_fw-76.png" width="76" />

                    <icon height="152" src="www/img/icons/pp_icon_square_fw-152.png" width="152" />

                    <icon height="40" src="www/img/icons/pp_icon_square_fw-40.png" width="40" />

                    <icon height="80" src="www/img/icons/pp_icon_square_fw-80.png" width="80" />

                    <icon height="57" src="www/img/icons/pp_icon_square_fw-57.png" width="57" />

                    <icon height="114" src="www/img/icons/pp_icon_square_fw-114.png" width="114" />

                    <icon height="72" src="www/img/icons/pp_icon_square_fw-72.png" width="72" />

                    <icon height="144" src="www/img/icons/pp_icon_square_fw-144.png" width="144" />

                    <icon height="29" src="www/img/icons/pp_icon_square_fw-29.png" width="29" />

                    <icon height="58" src="www/img/icons/pp_icon_square_fw-58.png" width="58" />

                    <icon height="50" src="www/img/icons/pp_icon_square_fw-50.png" width="50" />

                    <icon height="100" src="www/img/icons/pp_icon_square_fw-100.png" width="100" />

                </platform>

                <preference name="SplashScreen" value="splash" />

                <preference name="SplashScreenDelay" value="9000" />

                <preference name="AutoHideSplashScreen" value="false" />

                <preference name="ShowSplashScreenSpinner" value="false" />

                <gap:splash src="www/img/splash/android/drawable/screen.png" />

                <gap:splash gap:platform="android" gap:qualifier="port-ldpi" src="www/img/splash/android/drawable-ldpi/screen.png" />

                <gap:splash gap:platform="android" gap:qualifier="port-mdpi" src="www/img/splash/android/drawable-mdpi/screen.png" />

                <gap:splash gap:platform="android" gap:qualifier="port-hdpi" src="www/img/splash/android/drawable-hdpi/screen.png" />

                <gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="www/img/splash/android/drawable-xhdpi/screen.png" />

                <gap:splash gap:platform="android" gap:qualifier="port-xxhdpi" src="www/img/splash/android/drawable-xxhdpi/screen.png" />

                <gap:splash gap:platform="android" gap:qualifier="port-xxxhdpi" src="www/img/splash/android/drawable-xxxhdpi/screen.png" />

                <gap:splash gap:platform="ios" height="480" src="www/img/splash/ios/Default.png" width="320" />

                <gap:splash gap:platform="ios" height="960" src="www/img/splash/ios/640x960.png" width="640" />

                <gap:splash gap:platform="ios" height="1136" src="www/img/splash/ios/640x1136.png" width="640" />

                <gap:splash gap:platform="ios" height="1334" src="www/img/splash/ios/750x1334.png" width="750" />

                <gap:splash gap:platform="ios" height="1024" src="www/img/splash/ios/768x1024.png" width="768" />

                <gap:splash gap:platform="ios" height="2208" src="www/img/splash/ios/1242x2208.png" width="1242" />

                <gap:splash gap:platform="ios" height="2008" src="www/img/splash/ios/1536x2008.png" width="1536" />

                <gap:splash gap:platform="ios" height="2048" src="www/img/splash/ios/1536x2048.png" width="1536" />

                <feature name="SplashScreen">

                    <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen" />

                    <param name="ios-package" value="CDVSplashScreen" />

                </feature>

                <feature name="InAppPurchase">

                    <param name="ios-package" value="InAppPurchase" />

                </feature>

                <feature name="http://api.phonegap.com/1.0/network" />

                <feature name="http://api.phonegap.com/1.0/device" />

                <feature name="http://api.phonegap.com/1.0/geolocation" />

                <universal-links>

                    <ios-team-id value="teamidABC" />

                    <host name="www.example.com" scheme="https">

                        <path url="*" />

                    </host>

                </universal-links>

                <gap:plugin name="cordova-plugin-battery-status" source="npm" />

                <gap:plugin name="cordova-plugin-device-orientation" source="npm" />

                <gap:plugin name="cordova-plugin-globalization" source="npm" />

                <gap:plugin name="cordova-plugin-media" source="npm" />

                <gap:plugin source="git" spec="https://github.com/nordnet/cordova-universal-links-plugin" />

                <gap:plugin source="git" spec="https://github.com/caleb87/SocialSharing-PhoneGap-Plugin" />

                <gap:plugin source="git" spec="https://github.com/vilic/cordova-plugin-tts.git" />

                <gap:plugin source="git" spec="https://github.com/caleb87/cordova-plugin-hidden-statusbar-overlay" />

                <gap:plugin name="cordova-plugin-console" source="npm" />

                <gap:plugin name="cordova-plugin-device" source="npm" />

                <gap:plugin name="cordova-plugin-network-information" source="npm" />

                <gap:plugin name="cordova-plugin-geolocation" source="npm">

                    <variable name="GEOLOCATION_USAGE_DESCRIPTION" value="Navigation" />

                </gap:plugin>

                <gap:plugin name="cordova-plugin-splashscreen" source="npm" />

                <gap:plugin name="cordova-plugin-insomnia" source="npm" />

                <gap:plugin name="cordova-plugin-whitelist" source="npm" />

                <gap:plugin name="cordova-plugin-inappbrowser" source="npm" />

                <gap:plugin name="cordova-plugin-inapppurchase" source="npm" />

                <gap:plugin source="git" spec="https://github.com/mapsplugin/cordova-plugin-googlemaps">

                    <param name="API_KEY_FOR_ANDROID" value="key" />

                    <param name="API_KEY_FOR_IOS" value="key" />

                </gap:plugin>

                <gap:config-file parent="CFBundleShortVersionString" platform="ios">

                    <string>110</string>

                </gap:config-file>

                <gap:config-file overwrite="false" parent="NSLocationAlwaysUsageDescription" platform="ios">

                    <array>

                        <string>GPS for navigation</string>

                    </array>

                </gap:config-file>

                <gap:config-file overwrite="false" parent="NSLocationWhenInUseUsageDescription" platform="ios">

                    <array>

                        <string>GPS for navigation</string>

                    </array>

                </gap:config-file>

                <gap:config-file parent="/manifest" platform="android">

                    <application android:debuggable="true" />

                </gap:config-file>

                <access origin="http://phonegap.com" subdomains="true" />

                <access origin="https://phonegap.com" subdomains="true" />

                <access origin="http://debug.phonegap.com" subdomains="true" />

                <access origin="*" subdomains="true" />

                <allow-intent href="*" />

                <allow-navigation href="*" />

                <platform name="android">

                    <allow-intent href="*" />

                    <allow-navigation href="*" />

                </platform>

                <platform name="ios">

                    <allow-intent href="*" />

                    <allow-navigation href="*" />

                </platform>

                <engine name="android" spec="~6.1.2" />

                <engine name="browser" spec="~4.1.0" />

            </widget>

            • 3. Re: add plugins from config.xml
              simon.macdonald Adobe Employee

              IIRC the CLI does not read the gap:TAG_NAME. You should remove the xmlns:gap="http://phonegap.com/ns/1.0" from the widget tag and then delete all instances of gap: and try to build again.

              • 4. Re: add plugins from config.xml
                BigLittle8712 Level 1

                EDIT: Just saw your post. Will try that and get back.

                 

                So I just did a build, and the log shows:

                Checking config.xml for saved platforms that haven't been added to the project

                 

                Checking for any plugins added to the project that have not been installed in android platform

                 

                No differences found between plugins added to project and installed in android platform. Continuing...

                 

                I don't believe this is a bug. I just don't understand how it works. Here's what I did:

                 

                I created a project folder with terminal

                 

                I copied my app files to the www folder, and copied the config.xml to the root.

                 

                I did phonegap prepare which didn't download them. On Mac, I did the same thing but when I did phonegap serve it actually downloaded all the core plugins, but left out others like googlemaps.

                 

                Is there maybe another config file elsewhere? I read that the root folder is preferred place for the config.

                • 5. Re: add plugins from config.xml
                  BigLittle8712 Level 1

                  Removing the gap: tag fixed it!

                   

                  Thanks Simon!