9 Replies Latest reply on Sep 26, 2016 10:42 AM by byronlevi

    Issue with Android config.xml

    byronlevi Level 1

      Hi All,

      I am working with a team and we are more familiar with builds for iOS.

      We created this config.xml for the Android build, however, when we try downloading and testing it on devices, it crashes after opening.

      I am guessing the config.xml document may contain errors causing this.

       

      Could you review the below config.xml for Android and provide your thoughts or even a base config.xml we could use?

       

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

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

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

        xmlns:android = "http://schemas.android.com/apk/res/android"

        id        = "com.company.appname"

        versionCode="20"

        version   = "2.0.0">

       

        <name>APPNAME</name>

        <description>Description Here.</description>

        <author href="http://www.company.com" email="none@none.com">AuthorName</author>

       

       

       

      <preference name="phonegap-version" value="cli-6.3.0" />

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

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

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

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

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

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

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

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

      <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="FadeSplashScreen " value="true" />

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

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

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

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

      <preference name="TopActivityIndicator" value="white" />

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

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

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

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

      <preference name="windows-identity-name" value="" />

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

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

      <preference name="android-maxSdkVersion" value="16" />

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

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

      <preference name="ErrorUrl" value="null" />

      <preference name="BackgroundColor" value="0x000000" />

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

      <preference name="LoadingDialog" value="," />

      <preference name="LoadUrlTimeoutValue" value="null" />

       

       

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

       

       

      <allow-intent href="http://*/*" />

      <allow-intent href="https://*/*" />

      <allow-intent href="tel:*" />

      <allow-intent href="sms:*" />

       

        <platform name="android">

        </platform>

       

        <icon src="icon.png" />

        

              <!-- Android Splash Screens for PhoneGap -->

              <platform name="android">

               <splash src="androidl.png"    density="ldpi" />

        <splash src="androidm.png"    density="mdpi" />

        <splash src="anroidh.png"    density="hdpi" />

             <splash src="androidx.png"   density="xhdpi" />

          </platform>

       

          </widget>

       

       

      Thank you for your help!

        • 1. Re: Issue with Android config.xml
          VectorP Level 4

          1. Change this to value=15:

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

           

          2. Change this to a value between 15 and 24:

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

           

          3. Change this to a value >=16 and >= targetSdkVersion

          <preference name="android-maxSdkVersion" value="16" />

           

          4. This combination makes no sense, since yu are saying: "don't hide my splash automatically, and do so after 1 second".:

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

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

           

          5. Your whitelist rules won't work, since you are missing the whitelist plugin.

          Add <plugin name="cordova-plugin-whitelist" />

           

          6. You may want to add splashes for xxhdpi and xxxhdpi.

           

          How does your app 'crash'? Do you get any error messages? Is external content not loaded?

          • 2. Re: Issue with Android config.xml
            byronlevi Level 1

            Thanks for your help!

            I went ahead and made the updates you mention above.

            The app still crashes when we try opening it on our provisioned test devices.

             

            Any other updates we could try?

            • 3. Re: Issue with Android config.xml
              VectorP Level 4

              Again:

              How does your app 'crash'? Do you get any error messages? Is external content not loaded?

               

              Also, I'm not sure what you mean with 'provisioned test devices'. We are talking Android, aren't we?

              1 person found this helpful
              • 4. Re: Issue with Android config.xml
                kerrishotts Adobe Community Professional

                It would help to see what's being logged to your device's console when the crash occurs. "adb logcat" is the way I'd normally do it, but you may not have this installed since you are using PGB. IIRC, there are apps on the Play store that let you see what's in the logs, though. Those might require root access, though -- not sure.

                 

                Chances are good the console logs will indicate the reason the app is crashing.

                 

                I'd suggest using Chrome's remote debugging tools, but if your app is crashing immediately after open, I doubt you'd ever get the chance to start up a debug session.

                1 person found this helpful
                • 5. Re: Issue with Android config.xml
                  Chris W. Griffith Adobe Community Professional

                  Here is a minimal Android config.xml based off

                   

                  <?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.company.testappname" versionCode="20" version="2.0.0">

                    <name>TEST APP NAME</name>

                    <description>Description Here.</description>

                    <author href="http://www.company.com" email="none@none.com">AuthorName</author>

                    <preference name="phonegap-version" value="cli-6.3.0"/>

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

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

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

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

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

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

                    <!--<preference name="SplashScreenDelay" value="1000"/>-->

                    <!--<preference name="BackgroundColor" value="0x000000"/>-->

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

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

                    <allow-intent href="http://*/*"/>

                    <allow-intent href="https://*/*"/>

                    <allow-intent href="tel:*"/>

                    <allow-intent href="sms:*"/>

                    <platform name="android">

                   

                   

                    </platform>

                    <icon src="icon.png"/>

                    <!-- Android Splash Screens for PhoneGap -->

                    <platform name="android">

                      <splash src="androidl.png" density="ldpi"/>

                      <splash src="androidm.png" density="mdpi"/>

                      <splash src="anroidh.png" density="hdpi"/>

                      <splash src="androidx.png" density="xhdpi"/>

                    </platform>

                  </widget>

                   

                  I have compiled a test app and this config.xml is fine.

                   

                  I would recommend including the full icon suite, as well as the splash screens for higher densities.

                   

                  The Splashscreen is commented out, as the test app did not handle it.

                  The Background color is turned off as well, as you don't need it.

                   

                  The other preferences that were removed are either for other platforms or set with default values. Until you need to change a preference, don't add it in.

                   

                  The app can be found at: GitHub - chrisgriffith/PhoneGapBuild-Android_test

                   

                  Chris

                  1 person found this helpful
                  • 6. Re: Issue with Android config.xml
                    VectorP Level 4

                    Hi Chris.

                    I may be misunderstanding several things about this config, of which you claim

                    ... and this config.xml is fine.

                     

                    1. What is the reason to specify namespace xmlns:gap, which you don't use?

                    2. How do you get the allow-intent rules to take effect, without whitelist plugin?

                    3. Why did you include an empty

                      <platform name="android"></platform>

                      when you already have such element for the splashes?

                    4. Since you have default orientation, what would be the dimensions of the splash graphics?

                    1 person found this helpful
                    • 7. Re: Issue with Android config.xml
                      Chris W. Griffith Adobe Community Professional

                      This sample config.xml file was solely based off the original poster's version. I did not try to improve beyond getting it to 'useable' state for them.

                       

                      But to answer your questions:

                      1) No particular reason.

                      2) The source config.xml had them. I did not want to include it. In part, figured get them to the first step of not having the app crash at start.

                      3) A platform needed to be defined, and this was how the source was.

                      4) For Android ,you do not include dimensions in the tags. The Git repo has sample images.

                       

                      The goal was simply to get a working version for this poster. If there were only a tool to help PhoneGap Build users create config.xml files....

                       

                      Chris

                      1 person found this helpful
                      • 8. Re: Issue with Android config.xml
                        VectorP Level 4

                        If there were only a tool to help PhoneGap Build users create config.xml files.

                        Wouldn't that be awesome, Chris?

                        Oh, wait...!

                        :-)

                         

                        My questions were somewhat retorical. The point was, that a 'minimal working config' should be as correct as possible, because people would read your post and have little doubt that this would finally be a proper template. They would use it without considering reading the PGB Docs (as we see so often).

                        Specifically this:

                         

                        4. Since you have default orientation, what would be the dimensions of the splash graphics?

                        4) For Android ,you do not include dimensions in the tags.

                         

                        True, but please read again. You have default orientation, which means both landscape and portrait.

                        Now, suppose you have indeed separate images for these orientations, AND you have specified

                        <splash src="anroidh.png" density="hdpi"/>

                        then what is this? The landscape image? The portrait image? Is it a squared image, which has to be pressed into a recatngular device screen?

                        Or would it be better to always combine 'orientation=default' with

                        <splash src="anroidhp.png" qualifier="port-hdpi"/>

                        <splash src="anroidhl.png" qualifier="land-hdpi"/>

                        ?

                        1 person found this helpful
                        • 9. Re: Issue with Android config.xml
                          byronlevi Level 1

                          Thank you for your help with this! Our config.xml file is now working. I really appreciate your suggestions!