14 Replies Latest reply on Sep 12, 2016 1:37 PM by juanf9224

    cant update already published app after phonegap build

    juanf9224 Level 1

      Hi, i have an app already published to the app store, i built it with ionic cli, then i changed to phonegap build, the app works, but when i try to update my old version, throws an error: "App not installed", so i deleted old version, then installed new one and it does install, so i go for the play store and when i get to my published app, it says to update, as if the new version is older, but i have greater versionCode and version, what could be the problem here?

       

      PD: when i build with ionic cli works fine, i can update old one, but i would prefer build with phonegap for time convenience.

        • 1. Re: cant update already published app after phonegap build
          VectorP Level 4

          Could it be that you have multiple versions at Google's Play Store, with different minSdkVersion and/or targetSdkVersion?

          • 2. Re: cant update already published app after phonegap build
            martinb77004568 Level 1

            Have you recently changed anything on PGB regarding the versionCode? A while ago, when setting the versionCode as widget attribute, the app got another versionCode after being built. E.g.: I set the versionCode on "1" in the config.xml, the result was 18. When setting it to "2", it was 28. This was/is a well-known problem.

            I created a test build today and noticed that (when decompiling the .apk) the versionCode is now set correctly. When setting it to "1" in the config.xml, it was also "1" in the AndroidManifest.

            • 3. Re: cant update already published app after phonegap build
              VectorP Level 4

              The additional digit is added by the gradle build tool.

              Did you use gradle for that last Build?

              • 4. Re: cant update already published app after phonegap build
                martinb77004568 Level 1

                Yes, I did. I used this config.xml to test it:

                <?xml version="1.0" encoding="UTF-8" ?>
                <widget xmlns   = "http://www.w3.org/ns/widgets"
                        xmlns:android = "http://schemas.android.com/apk/res/android"
                        xmlns:gap   = "http://phonegap.com/ns/1.0"
                        id          = "com.example.example"
                        version        = "1.0.0"
                        versionCode = "1">
                    <name>Test-App</name>
                    <description>An example</description>
                    <access origin="*" />
                    <preference name='phonegap-version' value='cli-6.3.0' />
                    <platform name="android" />
                    <content src="index.html" />
                    <preference name="android-build-tool" value="gradle" />
                
                </widget>
                
                

                 

                I decompiled the app using Java decompiler online

                The resulting AndroidManifest.xml:

                 

                <?xml version="1.0" encoding="utf-8"?>
                <manifest xmlns:"http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0.0" android:windowSoftInputMode="20" android:installLocation="internalOnly" package="com.example.example" platformBuildVersionCode="23" platformBuildVersionName="6.0-2704002">
                   <uses-sdk android:minSdkVersion="14" />
                   <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:resizeable="true" android:xlargeScreens="true" />
                   <uses-permission android:name="android.permission.INTERNET" />
                   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
                   <application android:label="@string/app_name" android:icon="@drawable/icon" android:hardwareAccelerated="true">
                   <activity android:label="@string/app_name" android:name="com.example.example.Test_App" android:screenOrientation="unspecified" android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="0">
                   <intent-filter>
                   <action android:name="android.intent.action.MAIN" />
                   <category android:name="android.intent.category.LAUNCHER" />
                   </intent-filter>
                   </activity>
                   </application>
                </manifest>
                

                android:versionCode is "1" and not the expected "18". So, I think that something was changed - am I right?

                • 5. Re: cant update already published app after phonegap build
                  VectorP Level 4

                  Is that your full config, or just part  of it?

                  Especially: don't you have a preference for 'adroid-versionCode' in your config?

                   

                  I am not aware that they changed anything recently. At least there's nothing in a Blog about this.

                  (However, I'm aware that they change things quite often without making any announcement and without advancing any PGB version number.).

                  • 6. Re: cant update already published app after phonegap build
                    CurvyReality

                    The build service is down (as of 16.23 UK Time / 08.23 PST)?

                     

                    PhoneGap Build Service Status

                    • 7. Re: cant update already published app after phonegap build
                      martinb77004568 Level 1

                      Yes, this was my full config.xml I used to test it. I am not using the android-versionCode preference, I just set it as a widget attribute as shown above. I thought that this resulted in the "8" added to every build - I am pretty sure it was like that a few months ago. This could be the reason why some apps cannot be updated in PlayStore: When the config.xml doesn't include a android-versionCode preference, the version code will suddenly be decreased.

                      I am a bit worried - can I assume that the "8" won't be added in future builds, even if I only set the widget attribute? Or is it just a temporary thing?

                      • 8. Re: cant update already published app after phonegap build
                        juanf9224 Level 1

                        Hi, thanks for your answer, this is the android manifest by ionic cli:

                        <?xml version="1.0" encoding="utf-8"?>
                        <manifest xmlns:"http://schemas.android.com/apk/res/android" android:versionCode="101008" android:versionName="1.1.0" android:hardwareAccelerated="true" package="com.hostseven.bluecourier" platformBuildVersionCode="23" platformBuildVersionName="6.0-2438415">
                           <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
                           <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:resizeable="true" android:xlargeScreens="true" />
                           <uses-permission android:name="android.permission.INTERNET" />
                           <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
                           <application android:label="@string/app_name" android:icon="@drawable/icon" android:hardwareAccelerated="true" android:supportsRtl="true">
                           <activity android:theme="@*android:style/Theme.DeviceDefault.NoActionBar" android:label="@string/activity_name" android:name="com.hostseven.bluecourier.MainActivity" android:launchMode="singleTop" android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="10">
                           <intent-filter android:label="@string/launcher_name">
                           <action android:name="android.intent.action.MAIN" />
                           <category android:name="android.intent.category.LAUNCHER" />
                           </intent-filter>
                           </activity>
                           </application>
                        </manifest>
                        

                         

                        And this is android manifest by PGB:

                        <?xml version="1.0" encoding="utf-8"?>
                        <manifest xmlns:"http://schemas.android.com/apk/res/android" android:versionCode="20000" android:versionName="2.0.0" android:windowSoftInputMode="20" android:installLocation="auto" package="com.hostseven.bluecourier" platformBuildVersionCode="23" platformBuildVersionName="6.0-2704002">
                           <uses-sdk android:minSdkVersion="16" />
                           <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:resizeable="true" android:xlargeScreens="true" />
                           <uses-permission android:name="android.permission.INTERNET" />
                           <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
                           <application android:label="@string/app_name" android:icon="@drawable/icon" android:hardwareAccelerated="true">
                           <activity android:label="@string/app_name" android:name="com.hostseven.bluecourier.BlueCourierExpress" android:screenOrientation="unspecified" android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="0">
                           <intent-filter>
                           <action android:name="android.intent.action.MAIN" />
                           <category android:name="android.intent.category.LAUNCHER" />
                           </intent-filter>
                           </activity>
                           </application>
                        </manifest>
                        

                        PD: i see that one has android-sdk-target-version (Ionic cli) and one does not (PGB)

                        • 9. Re: cant update already published app after phonegap build
                          VectorP Level 4

                          1. Probably ionic and PGB set a different android SDK version per default.

                          2. The gradle 8-digit problem: see [Build] Gradle build add additional digit '8' after versionCode · Issue #462 · phonegap/build · GitHub

                          (and other articles, googling "bug cordova versioncode 8 gradle")

                          • 10. Re: cant update already published app after phonegap build
                            martinb77004568 Level 1

                            The ionic version shows that your versionCode was 101008. In the PGB version, your versionCode is 20000. Try to increase it to at least 101009.
                            Btw: Are you using the preference android-versionCode or have you set it on the widget attribute? (If you aren't sure: Just post the config.xml here )

                            • 11. Re: cant update already published app after phonegap build
                              juanf9224 Level 1

                              Here is my config.xml:

                               

                              <?xml version="1.0" encoding="UTF-8" ?>
                              <widget 
                                  xmlns="http://www.w3.org/ns/widgets" 
                                  xmlns:gap="http://phonegap.com/ns/1.0"
                                  id="PACKAGE.NAME.HERE" 
                                  version="2.0.0" 
                                  android-versionCode="20000">
                              
                              
                                  <name>NAME HERE</name>
                                  <description>
                                      
                                  </description>
                                  <author href="" email=""></author>
                                  <content src="index.html"/>
                                  <allow-navigation href="http://*/*"/>
                                <access origin="*"/>
                                <access origin="https://play.google.com/store/apps/*" launch-external="yes"/>
                              
                               <!-- Preferences -->
                               <preference name="fullscreen" value="false"/>
                               <preference name="webviewbounce" value="true"/>
                               <preference name="prerendered-icon" value="true"/>
                               <preference name="stay-in-webview" value="false"/>
                               <preference name="ios-statusbarstyle" value="black-opaque"/>
                               <preference name="detect-data-types" value="true"/>
                               <preference name="exit-on-suspend" value="false"/>
                               <preference name="disable-cursor" value="false"/>
                               <preference name="android-minSdkVersion" value="16"/>
                               <preference name="android-installLocation" value="auto"/>
                               <preference name="android-build-tool" value="gradle" />
                               <preference name="permissions" value="none"/>
                               <preference name="target-device" value="universal"/>
                               <preference name="AutoHideSplashScreen" value="false" />
                               <preference name="auto-hide-splash-screen" value="true"/>
                               <preference name="SplashShowOnlyFirstTime" value="false" />
                               <preference name="show-splash-screen-spinner" value="true"/>
                               <preference name="android-minSdkVersion" value="16"/>
                               <preference name="android-target-sdk-version" value="23"/>
                              
                              
                               <!-- Plugins -->
                               <!--<plugin name="org.apache.cordova.splashscreen"/>
                               <plugin name="phonegap-plugin-push" spec="1.8.1" source="npm" />-->
                               <plugin name="ionic-plugin-keyboard" spec="2.2.1" source="npm" />
                               <plugin name="cordova-plugin-device" spec="1.1.2" source="npm"/>
                               <plugin name="cordova-plugin-whitelist" version="1.2.2" source="npm"/>
                               <plugin name="cordova-plugin-statusbar" spec="2.1.3" source="npm"/>
                               <plugin name="com.telerik.plugins.nativepagetransitions" spec="0.6.5" source="npm"/>
                               <plugin name="cordova-plugin-inappbrowser" spec="1.4.0" source="npm"/>
                               <plugin name="cordova-plugin-app-version" spec="0.1.8" source="npm"/>
                               <plugin name="cordova-plugin-network-information" spec="1.2.1" source="npm"/>
                               <plugin name="cordova-plugin-splashscreen" spec="3.2.2" source="npm"/>
                              
                              
                               <icon src="resources/icon/default/icon.png"/>
                               <splash src="splash/default/splash.png"/>
                              
                              
                               <platform name="android">
                              
                              
                                   <allow-intent href="market:*"/>
                                      
                                   <!-- Icons -->
                                   <icon src="resources/icon/android/icon-36-ldpi.png" qualifier="ldpi"/>
                                   <icon src="resources/icon/android/icon-48-mdpi.png" qualifier="mdpi"/>
                                   <icon src="resources/icon/android/icon-72-hdpi.png" qualifier="hdpi"/>
                                   <icon src="resources/icon/android/icon-96-xhdpi.png" qualifier="xhdpi"/>
                                   <icon src="resources/icon/android/icon-144-xxhdpi.png" qualifier="xxhdpi"/>
                                   <icon src="resources/icon/android/icon-192-xxxxhdpi.png" qualifier="xxxhdpi"/>
                                   
                                   <!-- Portrait -->
                                   <splash src="splash/android/drawable-port-ldpi-screen.png" qualifier="port-ldpi"/>
                                   <splash src="splash/android/drawable-port-mdpi-screen.png" qualifier="port-mdpi"/>
                                   <splash src="splash/android/drawable-port-hdpi-screen.png" qualifier="port-hdpi"/>
                                   <splash src="splash/android/drawable-port-xhdpi-screen.png" qualifier="port-xhdpi"/>
                                   <splash src="splash/android/drawable-port-xxhdpi-screen.png" qualifier="port-xxhdpi"/>
                                   <splash src="splash/android/drawable-port-xxxhdpi-screen.png" qualifier="port-xxxhdpi"/>
                              
                              
                                   <!-- Landscape -->
                                   <splash src="splash/android/drawable-land-ldpi-screen.png" qualifier="land-ldpi"/>
                                   <splash src="splash/android/drawable-land-mdpi-screen.png" qualifier="land-mdpi"/>
                                   <splash src="splash/android/drawable-land-hdpi-screen.png" qualifier="land-hdpi"/>
                                   <splash src="splash/android/drawable-land-xhdpi-screen.png" qualifier="land-xhdpi"/>
                                   <splash src="splash/android/drawable-land-xxhdpi-screen.png" qualifier="land-xxhdpi"/>
                                   <splash src="splash/android/drawable-land-xxxhdpi-screen.png" qualifier="land-xxxhdpi"/>
                              
                              
                               </platform>
                              
                              
                               <platform name="ios">
                              
                              
                                   <allow-intent href="itms:*"/>
                                   <allow-intent href="itms-apps:*"/>
                              
                              
                               <!-- Icons -->
                                   <icon src="resources/icon/ios/icon-40.png" width="40" height="40"/>
                                   <icon src="resources/icon/ios/icon-40@2x.png" width="80" height="80"/>
                                   <icon src="resources/icon/ios/icon-57.png" width="57" height="57"/>
                                   <icon src="resources/icon/ios/icon-57@2x.png" width="114" height="114"/>
                                   <icon src="resources/icon/ios/icon-60.png" width="60" height="60"/>
                                   <icon src="resources/icon/ios/icon-60@2x.png" width="120" height="120"/>
                                   <icon src="resources/icon/ios/icon-72.png" width="72" height="72"/>
                                   <icon src="resources/icon/ios/icon-72@2x.png" width="144" height="144"/>
                                   <icon src="resources/icon/ios/icon-76.png" width="76" height="76"/>
                                   <icon src="resources/icon/ios/icon-76@2x.png" width="152" height="152"/>
                                   <icon src="resources/icon/ios/icon-83.5@2x.png" width="167" height="167"/>
                                   <icon src="resources/icon/ios/icon-small.png" width="29" height="29"/>
                                   <icon src="resources/icon/ios/icon-small@2x.png" width="58" height="58"/>
                                   <icon src="resources/icon/ios/icon-small@3x.png" width="87" height="87"/>
                              
                              
                                   <!-- Portrait -->
                                   <splash src="splash/ios/Default~iphone.png" width="320" height="480"/>
                                   <splash src="splash/ios/Default@2x~iphone.png" width="640" height="960"/>
                                   <splash src="splash/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
                                   <splash src="splash/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
                                   <splash src="splash/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/> 
                                   <splash src="splash/ios/Default-667h.png" width="2208" height="1242"/>
                                   <splash src="splash/ios/Default-736h.png" width="750" height="1134"/>
                                   
                              
                              
                                   <!-- Landscape -->
                                   <splash src="splash/ios/Default-Landscape~ipad.png" width="1024" height="768"/> 
                                   <splash src="splash/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
                                   <splash src="splash/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
                              
                              
                               </platform>
                              
                              
                               <access origin="*"/>
                               <allow-intent href="http://*/*"/>
                               <allow-intent href="https://*/*"/>
                               <allow-intent href="tel:*"/>
                               <allow-intent href="sms:*"/>
                               <allow-intent href="mailto:*"/>
                               <allow-intent href="geo:*"/>
                              </widget>
                              
                              • 12. Re: cant update already published app after phonegap build
                                juanf9224 Level 1

                                i noticed that in activity tag, the "android:name" attribute is different, in manifest generated by inonic cli the value is "PACKAGE.NAME.HERE.MainActivity" but in the PGB one the value is "PACKAGE.NAME.HERE.APP-NAME".

                                 

                                ionic cli:

                                <activity android:theme="@*android:style/Theme.DeviceDefault.NoActionBar" android:label="@string/activity_name" android:name="PACKAGE.NAME.HERE.MainActivity" android:launchMode="singleTop" android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="10">
                                

                                 

                                PGB:

                                <activity android:label="@string/app_name" android:name="PACKAGE.NAME.HERE.APP-NAME" android:screenOrientation="unspecified" android:configChanges="locale|keyboard|keyboardHidden|orientation|screenSize" android:windowSoftInputMode="0">
                                

                                 

                                may this have something to do?

                                • 13. Re: cant update already published app after phonegap build
                                  martinb77004568 Level 1

                                  Increase your android-versionCode to at least 101009, then it should work.

                                   

                                  I still don't understand why the versionCode suddenly doesn't add the "8" at the end... Is is somehow possible to find out why the change was made and if it will work in this way in the future? Somebody must have changed it in PGB :-) And: What is the difference between android-versionCode and versionCode (as widget attribute)?

                                  • 14. Re: cant update already published app after phonegap build
                                    juanf9224 Level 1

                                    increasing android-versionCode to 101009 did the trick, Thanks a lot!!