3 Replies Latest reply on Jul 26, 2016 8:25 AM by VectorP

    Mi app no arranca - Problemas con el Config.xml

    freelocreativo

      Hola a todos. Había creado un app con la version del plugin 3.0.0 y me funcionaba poerfectamente al instalarla en el móvil.

      La he actualizado a la version del plugin cli-5.2.0 compilada con Phonega Build. Se compila bien, solo que al instalarla en el dispositivo no funciona.

      Este es mi directorio de archivos:

      Captura de pantalla 2016-07-25 a las 4.31.21 p.m..png

      Este es mi 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"

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

        id        = ""

        versionCode="1.1.1"

        version   = "2.0.1">

        <content src="index.html" />

        <name></name>

        <description></description>

        <author href="http://www.freelocreativo.com" email="leorincon@freelocreativo.com">Leonardo Rincon</author>

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

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

       

      <!-- Plugin-->

      <plugin name="cordova-plugin-inappbrowser" source="pgb" spec="1.0.1" />

      <plugin name="org.apache.cordova.splashscreen" version="2.1.0"/>

      <plugin name="cordova-plugin-whitelist" spec="1.2.2" />

      <plugin name="phonegap-admob" spec="4.1.11" source="npm"/>

      <!-- Plugin-->

       

       

      <!-- Preferencias -->

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

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

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

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

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

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

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

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

      <preference name="ios-statusbarstyle" value="default" />

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      <preference name="LoadingDialog" value="Carga de Poder," />

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

      <!-- Terminan las Preferencias-->

       

       

      <!-- Iconos para Android-->

      <platform name="android">

        <icon src="res/36.png" />

        <icon src="res/icon/android/36.png" qualifier="ldpi" />

          <icon src="res/icon/android/48.png" qualifier="mdpi" />

          <icon src="res/icon/android/72.png" qualifier="hdpi" />

          <icon src="res/icon/android/96.png" qualifier="xhdpi" />

        <icon src="res/icon/android/144.png" qualifier="xxhdpi" />

        <icon src="res/icon/android/192.png" qualifier="xxxhdpi" />

       

      <!-- Terminan los Iconos para Android-->

      <!-- los Screen para Android-->

        <splash src="res/screen/android/200x320.png"  qualifier="port-ldpi" />

        <splash src="res/screen/android/320x480.png"  qualifier="port-mdpi" />

        <splash src="res/screen/android/480x800.png"  qualifier="port-hdpi" />

        <splash src="res/screen/android/720x1280.png" qualifier="port-xhdpi" />

        <splash src="res/screen/android/960x1600.png" qualifier="port-xxhdpi" />

        <splash src="res/screen/android/1280x1920.png" qualifier="port-xxxhdpi" />

        </platform>

       

      <!--permisos-->

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

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

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

      <access origin="http://www.poderonlineradio.chatango.com" subdomains="false" />

      <access origin="http://199.217.118.14:8111/;stream/1" subdomains="true" />

       

       

      </widget>

      Algo que me sorprende es que si elimino el config.xml la aplicación se ejecuta bien, sin problema, solo que obviamente no lee los iconos, splash ni especificaciones hechas en el config.xml.

      Al parecer los plugin se instalan por que la nube los guarda en una especie de caché o algo así.

       

      Espero puedan ayudarme con este problema

        • 1. Re: Mi app no arranca - Problemas con el Config.xml
          VectorP Level 4

          1. You could have stayed in the other thread where you posted your problem

           

          2. Now, suddenly, you have added two feature elements. I don't know why you did that, but you should remove them.

           

          3. Otherwise, your directory structure and config seem to be OK.

          What does "my app doesn't start" mean exactly? Doesn't it get launched? Or do you see your splashscreen, then something unexpected (like a black or white screen, or a message of a crashed app)?

          If the latter, something might be wrong in your html/js code, so in that case it would be helpful to see your full zip file.

           

          (The fact that your app runs fine without a config could indicate that the whitelisting is not OK. The default config will allow for more/different access than your config does. For instance, you might need some "allow-navigation' rule)

          • 2. Re: Mi app no arranca - Problemas con el Config.xml
            freelocreativo Level 1

            1). Hola VectorP, agradezco tu respuesta, Decidi abrir una pregunta aparte por que no quería desviar el hilo anterior. (lo tendré en cuenta para la proxima).

            2. En cuanto  a las líneas

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

            <feature name="http://api.phonegap.com/1.0/notification"/> ¿Son las que dices que debo eliminar? las tengo por que realizo el config.xml con el software de confiGAP y este me sugiere esas líneas.

             

            3. Cuando digo que mi aplicación no se inicia, me refiero a que la puedo descargar, pero cuando le doy clic a el icono para abrirla me sale un aviso que dice: "Lamentablemente la aplicación se detuvo". No puedo ver el Splash, no puedo ver nada.

            Este es mi index.html

            <!DOCTYPE html>

            <html>

                <head>

                    <meta charset="utf-8" />

                    <meta name="format-detection" content="telephone=no" />

                    <meta name="msapplication-tap-highlight" content="no" />

                    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">

                    <link rel="stylesheet" type="text/css" href="css/index.css" />

                    <link rel="stylesheet" type="text/css" href="font.css">

                    <title>Radio Poder Online - Radio Cristiana juvenil</title>

                    <script type="text/javascript" src="js/iscroll.js"></script>

                    <script type="text/javascript">

             

            var myScroll;

             

             

            function loaded () {

              myScroll = new IScroll('#wrapper', { mouseWheel: true, click: true });

            }

             

             

            document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);

             

             

            </script>

             

             

            <script type="text/javascript" charset="utf-8">

             

             

                // CODIGO PARA ABRIR EL NAVEGADOR

                //

                document.addEventListener(onDeviceReady, false);

             

              function onDeviceReady() {

                    navigator.splashscreen.show();

                }

             

             

             

             

               function onDeviceReady() {

                    // external url

                    var ref = cordova.InAppBrowser.open('https://www.facebook.com/RadioPoderOnLineFans', '_blank', 'location=no', 'closebuttoncaption=Cerrar');

                    // relative document

                }

              function onDeviceReady2() {

                    // external url

                    var ref = cordova.InAppBrowser.open('https://twitter.com/OnlinePoder', '_blank', 'location=no', 'closebuttoncaption=Cerrar');

                    // relative document

                }

              function onDeviceReady3() {

                    // external url

                    var ref = cordova.InAppBrowser.open('http://www.poderonlineradio.chatango.com', '_blank', 'location=yes', 'closebuttoncaption=Cerrar');

                    // relative document

                }

             

            </script>

            <script type="text/javascript">

                     function onDeviceready() {

              admob.createBannerView({ publisherId: 'ca-app-pub-1074805840636567/5459050336'});

              }

              document.addEventListener('deviceready', onDeviceready, false);

                       

                    </script>

             

             

                 

                </head>

               

            <body  onload="loaded()">

             

             

                <header class="up">

                    <nav>

                    <ul>

                        <li><a href="javascript:myScroll.scrollToElement(document.querySelector('#home'))"><button><span class="icon-home"></span></button></a></li>

                        <li><a href="javascript:myScroll.scrollToElement(document.querySelector('#programas'))"><button> <span class="icon-mic"></span></button></a></li>

                        <li><a href="javascript:myScroll.scrollToElement(document.querySelector('#redes'))"><button><spa n class="icon-heart"></span></button></a></li>

                        <li><a href="javascript:myScroll.scrollToElement(document.querySelector('#equipo'))"><button><sp an class="icon-users"></span></button></a></li>

                        <li><button onClick="onDeviceReady3()"><span class="icon-bubbles"></span></button></li>

                        </ul>

                    </nav>

                   

                    </header>

                     <!--AQUI ABRIMOS LA IMAGEN CON EL ANUNCIO-->

                  <div id="anuncio">

                  <div class="btnanuncio"><a href="javascript:closeit()"><button><span class="icon-cross"></span></button></a></div>

                <div style="z-index:51"><a href="#" target="_blank" onclick="window.open('http://www.radiopoderonline.com/anuncio', '_system', 'location=no');"><img src="http://www.radiopoderonline.com/anuncio/imaanuncio.jpg" width="100%" height="auto" alt="" /> </a></div>

              </div>

                    <!--TERMINA EL ANUNCIO-->

                   

                <div id="wrapper">

              <div id="scroller">

                    <div class="contenedor">

                   

              <div id="home"><img src="img/logo.png" width="100%" height="auto" alt=""/></div>

                    <div id="programas"><p>

                    <h1>Programas</h1>

              

            </p>

            </div>

                    <p></p>

                    <div id="redes"><p>

                    <h1>Nuestras Redes Sociales</h1>

                    <ul>

                        <li><button onClick="onDeviceReady()"><span class="icon-facebook2"></span> Facebook</button></li>

                            <li><button onClick="onDeviceReady2()"><span class="icon-twitter"></span> Twitter</button></li>

                        </ul>

                    </p></div>

                    <p></p>

                    <div id="equipo">

                    <h1>Equipo de Comunicadores</h1>

                    <ul>

                        <li><h3>Equipo de Lanzamiento Poderonline</h3>

                            <img src="img/team1.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Jhon Edward Cardona - Director</h3>

                            <img src="img/team2.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Angélica Roja - DJ</h3>

                            <img src="img/team3.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Jhon M. - DJ</h3>

                            <img src="img/team4.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Angélica y Kelly - DJ</h3>

                            <img src="img/team9.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Al Aire con DJ Angélica y DJ Isabel</h3>

                            <img src="img/team10.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Yonelis - DJ</h3>

                            <img src="img/team11.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Al Aire - Power Night</h3>

                            <img src="img/team12.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Al aire - Power Musik</h3>

                            <img src="img/team13.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Power Break - Con DJ Angélica</h3>

                            <img src="img/team14.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>El Power Day al Aire - Con Yuli y Yolima</h3>

                            <img src="img/team15.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Yuli Vanegas - DJ</h3>

                            <img src="img/team16.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Yolima Bonilla - DJ</h3>

                            <img src="img/team18.jpg" width="100%" alt="Equipo Poder On Line"></li>

                            <hr>

                            <li><h3>Mujeres de Poder</h3>

                            <img src="img/team8.jpg" width="100%" alt="Equipo Poder On Line"></li>

                        </ul>

                    </div>

                    <p></p>

                    <div id="mensaje"><p>

                    </p></div>

                 </div>

                 </div>

            </div>

                 

                    <footer class="pie">

                    <audio id="demo" src="http://199.217.118.14:8111/;stream/1" autoplay></audio> 

                    <ul>

                        <li><button onclick="document.getElementById('demo').play()"><span class="icon-play3"></span></button></li>

                        <li><button onclick="document.getElementById('demo').pause()"><span class="icon-pause2"></span></button></li>

                         <li><a href="javascript:abrir()"><button><span class="icon-bullhorn"></span></button></a></li>

                        </ul>

                    </footer>

                   

               

                    <script type="text/javascript" src="cordova.js"></script>

                    <script type="text/javascript" src="js/index.js"></script>

                    <script type="text/javascript">

                        app.initialize();

                    </script>

                 <script type="text/javascript">

                function closeit(){

                document.getElementById("anuncio").style.visibility = "hidden";

                }

              function abrir(){

                document.getElementById("anuncio").style.visibility = "visible";

                }

                </script>

                </body>

            </html>

               <!-- <div class="app">

                        <h1>PhoneGap</h1>

                        <div id="deviceready" class="blink">

                            <p class="event listening">Connecting to Device</p>

                            <p class="event received">Device is Ready</p>

                        </div>

                    </div>-->

             

            Este es mi Index.js

            var app = {

                // Application Constructor

                initialize: function() {

                    this.bindEvents();

                },

               

                bindEvents: function() {

                    document.addEventListener('deviceready', this.onDeviceReady, false);

                },

                // deviceready Event Handler

                //

                // The scope of 'this' is the event. In order to call the 'receivedEvent'

                // function, we must explicitly call 'app.receivedEvent(...);'

                onDeviceReady: function() {

                    app.receivedEvent('deviceready');

                },

                // Update DOM on a Received Event

                receivedEvent: function(id) {

                    var parentElement = document.getElementById(id);

                    var listeningElement = parentElement.querySelector('.listening');

                    var receivedElement = parentElement.querySelector('.received');

             

             

                    listeningElement.setAttribute('style', 'display:none;');

                    receivedElement.setAttribute('style', 'display:block;');

             

             

                    console.log('Received Event: ' + id);

                }

            };

             

            Tambien tengo instalado el iscroll.js

            • 3. Re: Mi app no arranca - Problemas con el Config.xml
              VectorP Level 4

              1. OK

               

              2. Yes. If you use Phonegap Build, you should not have any feature elements.

              Everything that used to be configured with feature elements is done with plugins, now.

               

              3.

              I see a couple of errors:

               

              - document.addEventListener(onDeviceReady, false);

              Here, the event that is being listened to is missing. You want to listen to 'deviceready'.

               

              - In order to do this:

              Navigator.SplashScreen.Show ();

              you need the latest splashscreen plugin from npm. Nt the deprecated plugin from the obsolete pgb repo.

              cordova-plugin-splashscreen

              Make sure you don't capitalize:

               

              navigator.splashscreen.show();

               

              - next, I notice you have several functions 'onDeviceReady' and similar functions in your scripts. These may collide.
              Why do you need them?
              You also add an eventlistener for deviceready multiple times. Can't do that. It is fired and used just once for the document.
              - This contains several syntax errors and an error in the use of the options string for the inAppBrowser call:

              function onDeviceReady() {}

              external url

              var ref = cordova. InAppBrowser.open('https://www.facebook.com/RadioPoderOnLineFans', '_blank', 'location=no', 'closebuttoncaption=Cerrar');

              relative document

              }

               

              - You are also using

              window.open(...)

              which will not work with the inAppBrowser plugin. You should strictly stay with the inAppBrowser plugin documentation.

              - I notice several syntax errors in this piece of code:
              < audio id = "demo" src = " " http://199.217.118.14: 8111 /; stream / 1 ' autoplay > </audio > "
              However, I don't know if any of that was changed by the forum software. Probably it looks a bit different in your original code.
              The cause of the problem is most likely your 'creative' use of deviceready event listeners and the number of syntax errors.