12 Replies Latest reply on Jul 28, 2016 11:52 AM by prasannae40715669

    My app is not working after PhoneGap build

    prasannae40715669 Level 1

      I'm trying to create a mobile application for my existing web application. I have modified the code according to the PhoneGap directory structure. Also My application was working fine after uploading it in PhoneGap Desktop, since I can able to test the application in Desktop Browser through the provided local server address (ie. say http://169.254.80.80:3000/ ). But when I try to test the application in mobile through the provided local server address (ie. say http://169.254.80.80:3000/ ) in PhoneGap Mobile, my application was blank (empty). Similarly, when I try to download the application after the PhoneGap Build, I experience the same problem. Can anyone please help me on this?

        • 1. Re: My app is not working after PhoneGap build
          VectorP Level 4

          Sounds like you attempted to build in PGB with the "Phonegap directory structure". That would be wrong.

          Phonegap Build doesn't require any specific directory structure or special directory names. In fact, it doesn't require any directories at all. The only requirement is: have both index.html and config.xml in the same directory.

          The easiest way to do that: put them both in the root directory of your zip file. All other assets can either be in that same root or in any directory below that root, as you prefer.

          1 person found this helpful
          • 2. Re: My app is not working after PhoneGap build
            prasannae40715669 Level 1

            Thanks for your feedback. But unfortunately the solution doesn't work properly. Though it solves some problem. But still stuck in same place.

             

            Previously I had problem of including javascript files using CDN <script type="text/javascript" src="https://www.google.com/jsapi" ></script>. The error was "Failed to load resource: the server responded with a status of 404". I know this is because my app is working offline. But after your solution the error was rectified. Hope that because <access origin="*"/> in the config.xml file.

             

            But the user interface still remains the same (Blank). But now i have no error to rectify. So i have no clue right now how to fix this or where was the problem. Your help would be very much appreciable.

            • 3. Re: My app is not working after PhoneGap build
              Chris W. Griffith Adobe Community Professional

              I would review the url/location of your CSS and any other Javascript libraries you might be referencing

               

              Chris

              • 4. Re: My app is not working after PhoneGap build
                kerrishotts Adobe Community Professional

                Some thoughts:

                 

                • Don't include libraries via CDN. This takes time to download, and you have no way of verifying a complete and non-corrupt copy. Download the files to your project and distribute them as part of the app bundle. This will load quickly but also ensures that if you are ever without network access (or have a bad network connection) that your app can still load the library.
                • A blank page often indicates a JavaScript error during app start. Double check your app's JavaScript console (you can use either Google Chrome or Mobile Safari, depending on your platform) to see if your app is logging an error to the console.
                • A blank page could also indicate a failure to load a library, like Chris mentioned above. This is usually also obvious in the JS console.
                • It would help to see some code -- namely, config.xml, index.html, and the JS code responsible for startup. If you have any identifying information in those files that you don't want public, remove before posting. Or, if you are comfortable, share a link to your code or built app, and we can take a look.
                • 5. Re: My app is not working after PhoneGap build
                  prasannae40715669 Level 1

                  Hi Chris,

                   

                  I don't think there is any problem with url for css & javascript. Because there are no error in the console regarding the url. Also the application was working finely on phonegap desktop and phone mobile. The application is having problem only after phonegap build

                  • 6. Re: My app is not working after PhoneGap build
                    prasannae40715669 Level 1

                    Hi Kerrishots,

                     

                    I have to use CDN. Because the CDN i'm using is for google visualization. Below is the FAQ posted in developers.google.com that google visualization api cannot be downloaded and used.

                    Capture.PNG

                     

                    Thanks for your tips on Javascript error on blank page. I tried to debug my entire application line by line. I got the error from target-script-min.js - which i hope phonegap javascript file. While I was trying to rectify that error I got again ended up with cdn api error

                    Capture3.PNG

                     

                    I can share the build app for now. If you want more detail, then I can send you the code of my app. Please help me on this one.

                    https://www.dropbox.com/s/0nwfe905uxhe579/Hope-debug.apk?dl=0

                     

                    Thanks.

                    • 7. Re: My app is not working after PhoneGap build
                      VectorP Level 4

                      As I mentioned above, there appears to be a problem with the directory structure of your package.

                      The posted apk doesn't help much. Could you please make your zip file available and post its url here?

                      • 8. Re: My app is not working after PhoneGap build
                        kerrishotts Adobe Community Professional

                        Your APK indicates that you're uploading incorrectly -- there are two "www" directories, one nested in the other, like so:

                         

                        assets/www/www

                         

                        Each "www" directory has different files; the first "www" looks like your app, and the second looks like a default PhoneGap app. I wouldn't expect PGB to pick the correct one, so you need to ensure you only upload your web assets, not the entire project nor additional "www" directories.

                         

                        The APK should instead only have one "www" like so:

                         

                        assets/www

                         

                        Also, based on the APK, there's a lot of plugins in there. This might be because PGB is seeing the wrong config.xml file OR you've left them in your config.xml. Remove any plugins your app doesn't need.

                        • 9. Re: My app is not working after PhoneGap build
                          prasannae40715669 Level 1

                          Hi Kerri shotts,

                           

                          Sorry it's been few days I couldn't reply. I have been trying the whole day today using phone gap again. But still getting error for google api usage. Can you please send your mail address. I can send you my entire source code. Hope from there you can help me to build my app using phonegap build. Thanks in advance.

                           

                          Thanks,

                          Prasanna Elangovan

                          • 10. Re: My app is not working after PhoneGap build
                            kerrishotts Adobe Community Professional

                            Some more thoughts:

                             

                            • net::ERR_NAME_NOT_RESOLVED indicates a DNS lookup problem -- that is, no address was found for the corresponding domain. Make sure that your device is attached to a network that allows remote access and that there is a route to the hosts you're trying to contact.
                            • You're not waiting to load external resources until "deviceready" fires. Since the whitelist is in play, and it is a plugin, you can't do any network access until that plugin has finished initializing.
                            • I don't see a content-security-policy (CSP) meta tag in the index.html file. You should have one. See: GitHub - apache/cordova-plugin-whitelist: Mirror of Apache Cordova plugin whitelist
                            • 11. Re: My app is not working after PhoneGap build
                              prasannae40715669 Level 1

                              Even I cannot access the resources after the "deviceready" fires. Because I've created a sample application using phonegap desktop as given in - Step 3: Create Your App | PhoneGap Docs  and debugged it using google chrome. I've attached the chrome debug screenshots of that sample app. As you can see from below, it throws the same resource loading error.

                               

                              Capture5.PNG

                               

                              Also I tried to insert same google analytics api, which obviously also caused errors.

                               

                              Capture.PNG

                              • 12. Re: My app is not working after PhoneGap build
                                prasannae40715669 Level 1

                                Also please help me to enable the zoom in feature for the phonegap app. I've have already tried to use viewport meta tag and referred lot's of forums. But couldn't able to solve. So, if you send the source code of the zoom feature of the basic app - Step 3: Create Your App | PhoneGap Docs  would be helpful.