17 Replies Latest reply on Nov 19, 2016 9:04 AM by kerrishotts

    Build cli-6.3.0 version not works for android because of url failed

    blgsyrmhnds Level 1

        Build cli-6.3.0 version not works for android because of url failed.Although I used whitelist plugin!

      it works with build <preference name='phonegap-version' value='3.7.0' />  but it failed with cli-6.3.0

       

      Here is my app : https://build.phonegap.com/apps/2080558/builds 

      Here is my config.xml:

      ........

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

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

      <access origin="*"/> <!-- allow local pages -->

        <allow-navigation href="http://morehipo.com" />

          <allow-navigation href="http://morehipo.com/signalr/hubs" />

      ....

       

      and here is my index.html

      ......

      <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

      <script src="http://morehipo.com/signalr/hubs"></script>

          <script type='text/javascript'>

          

              window.REMOTE_HOST = 'http://morehipo.com';

            window.DEBUG = false;

        

          </script>

      ....

      What is problem with my code?How can I give access permission to all URL like

       

      <access origin="*"/>

        • 1. Re: Build cli-6.3.0 version not works for android because of url failed
          blgsyrmhnds Level 1

          Are there anyone?What is wrong with my code(index.html,config.xml...)?Should I install whitelist plugin? !

          • 2. Re: Build cli-6.3.0 version not works for android because of url failed
            VectorP Level 4

            This can't be yur full config.xml, because it doesn't vaidate as well-formed xml.

            In order to be able to help, it would be necessary to see your full config.

             

            Although I used whitelist plugin!

            Don't see any whitelist plugin in that 'config',

             

             

             

             

            • 3. Re: Build cli-6.3.0 version not works for android because of url failed
              blgsyrmhnds Level 1

              Thank you for answear

               

              Here is my full config

               

               

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

               

               

              <!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->

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

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

                      id        = "com.hybridsoftware.Okey101Katlama"

                      version  = "1.0">

               

               

                  <name>Okey 101 Katlama</name>

               

               

                  <description>

                  desc...

                  </description>

               

               

                  <author href="hybridsoftware.net" email="info@hybridSoftware.net">

                    Development

                  </author>

               

               

               

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

               

               

               

               

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

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

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

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

                  <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="show-splash-screen-spinner" value="true" />        

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

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

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

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

               

               

               

               

               

               

              <icon src="icon.png" gap:platform="ios" width="57" height="57" />

              <icon src="icon-60.png" gap:platform="ios" width="60" height="60" />

              <icon src="icon-60@2x.png" gap:platform="ios" width="120" height="120" />

              <icon src="icon@2x.png" gap:platform="ios" width="114" height="114" />

              <!-- iPad -->

              <icon src="icon-72.png" gap:platform="ios" width="72" height="72" />

              <icon src="icon-72@2x.png" gap:platform="ios" width="144" height="144" />

              <icon src="icon-76.png" gap:platform="ios" width="76" height="76" />

              <icon src="icon-76@2x.png" gap:platform="ios" width="152" height="152" />

               

               

              <!-- Settings Icon -->

              <icon src="icon-small.png" gap:platform="ios" width="29" height="29" />

              <icon src="icon-small@2x.png" gap:platform="ios" width="58" height="58" />

              <icon src="icon-50.png" gap:platform="ios" width="50" height="50" />

              <icon src="icon-50@2x.png" gap:platform="ios" width="100" height="100" />

               

               

              <!-- Spotlight Icon -->

              <icon src="icon-40.png" gap:platform="ios" width="40" height="40" />

              <icon src="icon-40@2x.png" gap:platform="ios" width="80" height="80" />

                <!-- Define app splash screen for each platform. -->

              <!-- iPhone and iPod touch -->

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

              <gap:splash src="Default@2x.png" gap:platform="ios" width="640" height="960" />

               

               

              <!-- iPhone 5 / iPod Touch (5th Generation) -->

              <gap:splash src="Default-568h@2x.png" gap:platform="ios" width="640" height="1136" />

               

               

              <!-- iPad -->

              <gap:splash src="Default-Portrait.png" gap:platform="ios" width="768" height="1024" />

              <gap:splash src="Default-Landscape.png" gap:platform="ios" width="1024" height="768" />

               

               

              <!-- Retina iPad -->

              <gap:splash src="Default-Portrait@2x.png" gap:platform="ios" width="1536" height="2048" />

              <gap:splash src="Default-Landscape@2x.png" gap:platform="ios" width="2048" height="1536" />

               

               

              <allow-navigation href="*" />

               

               

               

               

               

               

              </widget>

               

               

               

               

               

               

              and here is my index.html

               

               

               

               

              <!DOCTYPE html>

              <html class="no-js" lang="en">

              <head>

                <meta charset="utf-8" />

                <meta name="viewport" content="width=device-width" />

                <title>react-seed</title>

                  <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

                  <script src="jquery-1.10.2.min.js"></script>

                <link rel="stylesheet" href="materialize.min.css">

               

              </head>

              <body>

               

               

               

               

               

               

               

               

                <div id="app"></div>

               

                <script src="vendor.bundle.js"></script>

                <script src="materialize.min.js"></script>

               

               

               

               

                  <script src="http://morehipo.com/signalr/hubs"></script>

                  <script type='text/javascript'>

                

                      window.REMOTE_HOST = 'http://morehipo.com';

                    window.DEBUG = false;

               

                  </script>

                <script src="js/app.0.0.13.js"></script>

              </body>

              </html>

              • 4. Re: Build cli-6.3.0 version not works for android because of url failed
                VectorP Level 4

                You need a couple of plugins:

                - cordova-plugin-whitelist

                - cordova-plugin-splashscreen

                - cordova-plugin-statusbar

                 

                Also, you need a script element in your index.html, with a reference to 'cordova.js' (without actually including such file in your assets).

                • 5. Re: Build cli-6.3.0 version not works for android because of url failed
                  blgsyrmhnds Level 1

                  Thanks again and again dear @vectorP but it still give same error

                   

                  I added this line two line two my config.xml

                   

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

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

                   

                  and then

                  I added this line to my index.html

                   

                  <script type="text/javascript" charset="utf-8" src="cordova.js"></script> 

                   

                  should I download any cordova.js and add this .js file to my JS folder?

                  Or Should I download any whitelist and then add that file to my js folder?

                  • 6. Re: Build cli-6.3.0 version not works for android because of url failed
                    VectorP Level 4

                    You should do neither.

                     

                    a. What exactly means "....because url failed..."? What happens when?

                    b. Is your zip file available online somewhere, so I can have a look?

                    • 7. Re: Build cli-6.3.0 version not works for android because of url failed
                      blgsyrmhnds Level 1

                      My app is a game.It is realtime game.Clients send data via server so I used server but it failed(It works with phonegap version 3.7.0 but google play does not accept that version but apple store accept it: Okey 101 Katlamalı on the App Store   )

                       

                      here is my app: https://build.phonegap.com/apps/2080558/builds index html try to connect my server(morehipo.com but it failed) 

                       

                      here is  my zip folder:  okey101.xyz/development.zip 

                      • 8. Re: Build cli-6.3.0 version not works for android because of url failed
                        VectorP Level 4

                        I looked into your code, but unfortunately, you include a couple of multiple MB .js files with minified javascript, which I am not going to fight through.

                        However, I couldn't find any code that makes your app wait for the deviceready event. You are most likely already performing ajax requests before the whitelist plugin is ready to do so.

                         

                        To verify if that is the cause for your trouble: does the iOS version work as expected?

                        (If so, then yes, it's most likely the fact that you are attempting remote access too early.)

                        • 9. Re: Build cli-6.3.0 version not works for android because of url failed
                          blgsyrmhnds Level 1

                             Dear VectorP you see my config.xml and index.html

                          So  there is no problem with them.They include whitelist plugin and everything is ok.Is that true?

                           

                            .Js file is too long because it is node.js project and it include multiples npm package

                           

                          IOS version works very well and it is very good and it works very quickly altought js is too long.There is no problem with IOS...

                           

                          only it fail android with cli-6.3.0 versions

                          if I try android with  phonegap '3.7.0' versions(and unders) it works but google play does not accept phonegap 3.7.0 version

                           

                          remote acces works very quickly in IOS.And for android it does not work,it fail.I wait for hours but it still not connect

                          if my whitelist plugin code is good-true and there is problem with android what should I do?

                          thanks

                           

                          • 10. Re: Build cli-6.3.0 version not works for android because of url failed
                            VectorP Level 4

                            As I said: you need an eventListener for the deviceready event. Then, in the callback function, you can make your ajax requests.

                            Read up on this here: Events - Apache Cordova

                            • 11. Re: Build cli-6.3.0 version not works for android because of url failed
                              blgsyrmhnds Level 1

                              I tried all of that methods

                               

                              here is my index.html with  device ready event.But it give same error

                               

                               

                              <!DOCTYPE html>

                              <html class="no-js" lang="en">

                              <head>

                                <meta charset="utf-8" />

                                <meta name="viewport" content="width=device-width" />

                                <title>react-seed</title>

                                  <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

                                   <script src="jquery-1.10.2.min.js"></script>

                                <script type="text/javascript" charset="utf-8" src="cordova.js"></script> 

                               

                                <link rel="stylesheet" href="materialize.min.css">

                               

                                  <script src="http://morehipo.com/signalr/hubs"></script>

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

                               

                               

                               

                                  function onLoad() {

                                      document.addEventListener("deviceready", onDeviceReady, false);

                                  }

                                  function onDeviceReady() {

                                alert('device ready');

                                 window.REMOTE_HOST = 'http://morehipo.com';

                                    window.DEBUG = false;

                                  }

                               

                               

                                  </script>

                              </head>

                              <body onload="onLoad()">

                               

                               

                               

                               

                               

                               

                               

                               

                                <div id="app"></div>

                                

                                <script src="vendor.bundle.js"></script>

                                <script src="materialize.min.js"></script>

                               

                               

                                <script src="js/app.0.0.13.js"></script>

                              </body>

                              </html>

                              • 12. Re: Build cli-6.3.0 version not works for android because of url failed
                                VectorP Level 4

                                I need a bit more information about the error you are getting when 'the url fails'.

                                 

                                - exactly what is the error message?

                                - what is throwing the message?

                                - where, in your script flow, does the message get triggered?

                                • 13. Re: Build cli-6.3.0 version not works for android because of url failed
                                  blgsyrmhnds Level 1

                                  This two line in index.html cause error

                                  Because when server is break project does not work and given connection error

                                   

                                      window.REMOTE_HOST = 'http://morehipo.com';

                                        window.DEBUG = false;

                                   

                                   

                                  what should I do to handle error managment? VectorP

                                  you have zip code you try every method you know

                                   

                                  I am .net developer I am not good at pgonegap

                                  this error is about phonegap whitelist plugin.

                                   

                                  Are there any phonegap tools that I debug the project local?

                                  I am use windows 10 operating system

                                  i will be pleasure if you help me via teamviewer

                                   

                                  here is my email info@hybridsoftware.net

                                  • 14. Re: Build cli-6.3.0 version not works for android because of url failed
                                    VectorP Level 4

                                    This two line in index.html cause error

                                    No, those statements don't throw an error. They don't trigger an ajax request. They don't access anything.

                                     

                                    And could you please quote the exact error message instead of something like "my url fails"?

                                    • 15. Re: Build cli-6.3.0 version not works for android because of url failed
                                      blgsyrmhnds Level 1

                                      I could not do any thing?

                                      because I try everything but there is no solution dear VectorP

                                       

                                      I am sure error because of that two line because In server I log everything and I see that client cannot connect

                                      I share code with you can you debug it please?Or can you give me commands-directives because I try all thing,I could not find anyway

                                       

                                      I think all problem is about  content-security-policy meta tag

                                      and that security policy block server

                                       

                                      how can I set  content-security-policy for allow all URL?Because I am in dedline and my application is just game there is no security risks

                                       

                                      In my PC when I click index.html it gives that error in browser console

                                      but when I delete content-security-policy meta tag in index.html it works in PC browser

                                      ess.JPG

                                      • 16. Re: Build cli-6.3.0 version not works for android because of url failed
                                        blgsyrmhnds Level 1

                                        I think problem is about CSP

                                         

                                        This is CSP in my index.html

                                         <meta http-equiv="Content-Security-Policy" content="default-src *; 
                                        style-src 'self' 'unsafe-inline'; script-src 'self'
                                        'unsafe-inline' http://morehipo.com/signalr/hubs http://fonts.googleapis.com/css 'unsafe-eval'">

                                        But it give that error

                                        Refused to load the stylesheet because it violates the following Content Security Policy 
                                        directive:style-src self unsafe-inline

                                         

                                        Ekran.JPG

                                         

                                         

                                        How can I fix this?Or are there any CSP command that allow all permission for inline-outline css-URL.... my script hubs come from : http://morehipo.com this domain.I can not download them

                                        in that screen you can see error line

                                         

                                        Adsız.png

                                        • 17. Re: Build cli-6.3.0 version not works for android because of url failed
                                          kerrishotts Adobe Community Professional

                                          Try this CSP and let us know what breaks, if anything.

                                           

                                          <meta http-equiv="Content-Security-Policy"
                                                content="default-src 'self' data: gap: https://ssl.gstatic.com;
                                                         style-src 'self' 'unsafe-inline' blob: data: http://fonts.googleapis.com/css;
                                                         script-src 'self' 'unsafe-inline' http://morehipo.com/signalr/hubs  
                                                                    'unsafe-eval'">

                                          1 person found this helpful