17 Replies Latest reply on Jun 28, 2016 4:14 AM by VectorP

    No versionCode or versionName in manifest.xml

    UncatCrea Level 1

      I am investigating what PGB outputs in the AndroidManifest.xml file.

       

      I have specified a versionCode and a versionName in my config.xml file. However, it appears that these elements are missing from the generated AndroidManifest.xml file. Reading the Android Studio doc, it seems that it is up to Gadle to add these attributes.

       

      Can somebody confirm that PGB doesn't output versionCode and versionName in AndroidManifest.xml?

        • 1. Re: No versionCode or versionName in manifest.xml
          kerrishotts Adobe Community Professional

          Can you share your config.xml (minus identifying information)?

          • 2. Re: No versionCode or versionName in manifest.xml
            UncatCrea Level 1

            Sure.

             

            <?xml version="1.0" encoding="UTF-8" ?>

            <widget xmlns       = "http://www.w3.org/ns/widgets"

                    xmlns:gap   = "http://phonegap.com/ns/1.0"

                    id          = "com.mygreatapp"

                    versionCode = "1"

                    version     = "0.1.0" >

             

             

              <name>My great app</name>

             

             

              <description>My great app desc.</description>

             

             

              <author href="http://getwpappkit.com" email="uncategorized.creations@gmail.com">UncatCrea</author>

             

             

              <gap:platform name="android" />

              <preference name="android-build-tool" value="gradle" />

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

             

             

              <preference name="disallowOverscroll" value="true" />

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

             

             

              <!-- PhoneGap plugin declaration -->

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

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

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

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

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

              <plugin name="cordova-plugin-statusbar" source="npm" />

              <plugin name="cordova-plugin-crosswalk-webview" spec="1.5.0" source="npm" />

             

             

              <!-- Whitelist policy  -->

              <access origin="*" />

              <allow-intent href="*" />

              <allow-navigation href="*" />

             

             

              <!-- SplashScreen configuration -->

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

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

              <preference name="FadeSplashScreenDuration" value="300" />

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

             

             

              <!-- Icons and Splashscreens declaration -->

             

             

              <icon src="icon.png" gap:platform="android" />

              <icon src="icons/icon-wp-appkit-ldpi.png" gap:platform="android" gap:qualifier="ldpi" />

              <icon src="icons/icon-wp-appkit-mdpi.png" gap:platform="android" gap:qualifier="mdpi" />

              <icon src="icons/icon-wp-appkit-hdpi.png" gap:platform="android" gap:qualifier="hdpi" />

              <icon src="icons/icon-wp-appkit-xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />

              <icon src="icons/icon-wp-appkit-xxhdpi.png" gap:platform="android" gap:qualifier="xxhdpi" />

              <icon src="icons/icon-wp-appkit-xxxhdpi.png" gap:platform="android" gap:qualifier="xxxhdpi" />

             

              <gap:splash src="splash.9.png" gap:platform="android" />

              <gap:splash src="splashscreens/splashscreen-wp-appkit-ldpi.9.png" gap:platform="android" gap:qualifier="ldpi" />

              <gap:splash src="splashscreens/splashscreen-wp-appkit-mdpi.9.png" gap:platform="android" gap:qualifier="mdpi" />

              <gap:splash src="splashscreens/splashscreen-wp-appkit-hdpi.9.png" gap:platform="android" gap:qualifier="hdpi" />

              <gap:splash src="splashscreens/splashscreen-wp-appkit-xhdpi.9.png" gap:platform="android" gap:qualifier="xhdpi" />

              <gap:splash src="splashscreens/splashscreen-wp-appkit-xxhdpi.9.png" gap:platform="android" gap:qualifier="xxhdpi" />

              <gap:splash src="splashscreens/splashscreen-wp-appkit-xxxhdpi.9.png" gap:platform="android" gap:qualifier="xxxhdpi" />

             

            </widget>

            • 3. Re: No versionCode or versionName in manifest.xml
              kerrishotts Adobe Community Professional

              Check the docs at Android Platform Guide - Apache Cordova

               

              I think you need to use "android-versionCode" instead of "versionCode".

              • 4. Re: No versionCode or versionName in manifest.xml
                UncatCrea Level 1

                Thank you for your answer. I have done some research.

                 

                I've found that PGB doc is probably not up to date as it differs from Cordova's doc.

                 

                So I've done new tests using android-versionCode. Unfortunatly, I didn't succeed. I still don't have versionCode in my AndroidManifest.xml file

                • 5. Re: No versionCode or versionName in manifest.xml
                  jessem42288678 Level 2

                  UncatCrea,

                  I do not see a phonegap-version in your config.xml. This means you are getting the default version for PGB. In this case, it means cli-5.2.0

                   

                  See: Docs -> Configuring -> Preferences -> Multi-platform -> phonegap-version

                   

                  To be clear, the latest Cordova version is NOT the same as the default build version for PGB. I don't know about your particular issue, but you can try the latest version available for PGB by using the latest phonegap-version available. According to the current-support table, you can use cli-6.1.0.

                   

                  Lastly, if your issue is not resolved, let us know. We'll help you file a bug report on this.

                   

                  Best of Luck

                  Jesse

                  • 6. Re: No versionCode or versionName in manifest.xml
                    UncatCrea Level 1

                    Hi, thank you for your answer. I've done a test adding the phonegap-version preference set to cli-6.1.0 (and with the android-versionCode attribute). Unfortunatly, versionCode is still missing in my AndroidManifest.xml .

                    • 7. Re: No versionCode or versionName in manifest.xml
                      VectorP Level 4

                      The android-versionCode is not an attribute of the widget root. It's a preference in your config!

                      preference name="android-versionCode" value="123"

                       

                      Jesse: the phonegap-version is not related to this issue.

                      • 8. Re: No versionCode or versionName in manifest.xml
                        UncatCrea Level 1

                        Mmmh according this doc, it is an attribute of the widget root. Also, I've just done a compilation using preference instead of the attribute and I still don't have versionCode in my AndroidManifest.xml. Do you succeed to have it?

                        • 9. Re: No versionCode or versionName in manifest.xml
                          VectorP Level 4

                          That is a Cordova doc, not a Phonegap Build doc.

                          You are using Phonegap Build, aren't you?

                          • 10. Re: No versionCode or versionName in manifest.xml
                            UncatCrea Level 1

                            I do use PhoneGap Build and there's nothing versionCode preference in the doc: Preferences | PhoneGap Docs. There's even a config.xml example with... a versionCode attribute (and note that this is the same in the PhoneGap doc).

                             

                            As I said before, I have switched to versionCode preference without success. Still no versionCode in my AndroidManifest.xml.

                            • 11. Re: No versionCode or versionName in manifest.xml
                              VectorP Level 4

                              You seem to misunderstand the difference.

                               

                              versionCode is documented in the Phonegap Build docs. It's an attribute.

                               

                              android-versionCode is not documented in the PGB docs. It's a preference.

                              • 12. Re: No versionCode or versionName in manifest.xml
                                UncatCrea Level 1

                                Nonetheless using versionCode as an attribute or android-versionCode as a preference doesn't translate into any versionCode in AndroidManifest.xml using PhoneGap Build. Just did the tests.

                                • 13. Re: No versionCode or versionName in manifest.xml
                                  UncatCrea Level 1

                                  Hi, I've finally resolved the mystery :-) I want to thank everyone on this thread for you help.

                                  • I was checking the presence of the versionCode in the AndroidManifest.xml file by decoding my .apk file with apktool. Doing that, the manifest element never had an android:versionCode attribute.
                                  • That was a mistake. I finally did a check with AAPT (with the command aapt dump badging test.apk) and it gives me a versionCode.

                                   

                                  So it appears that everything is working fine. Just don't use apktool to check as I did.

                                   

                                  For the record, it seems that PGB concatenates an 8 to your version number (eg. 10 will become 108).

                                  • 14. Re: No versionCode or versionName in manifest.xml
                                    VectorP Level 4

                                    For the record, it seems that PGB concatenates an 8 to your version number (eg. 10 will become 108).

                                     

                                    It's the gradle build engine as implemented for PGB which does that.

                                    And that's why they introduced (but never documented) the preference 'android-versionCode', which supercedes the versionCode attribute. The latter gets an '8' added, the former doesn't.

                                    • 15. Re: No versionCode or versionName in manifest.xml
                                      UncatCrea Level 1

                                      Thank you VectorP, I've just done the test and I confirm that android-versionCode preference replaces the versionCode widget attribute. Mystery solved.

                                      • 16. Re: No versionCode or versionName in manifest.xml
                                        UncatCrea Level 1

                                        A last question: I've noticed that there's not versionCode at all (attribute or preference), you still end up with one. Anyone knows how it is calculated?

                                        • 17. Re: No versionCode or versionName in manifest.xml
                                          VectorP Level 4

                                          Normally, it's the incremental build number for the app in Phonegap Build.

                                          Of course, this sequence is broken, once the app is deleted, then recreated with a new app id, because the incremental build number starts at 1 again. So, from that moment on, you must include a versionCode with a higher number than the last versionCode of the 'previous' app, otherwise Google will complain.