APK file not working like it should.

  • 1
  • Problem
  • Updated 4 years ago
I just made my first build with phonegap and downloaded the apk, but it's not working like it should. When i test my app through the phonegap app it's working great. But when i download the apk it doesn't work the same way, the display is different and some of the JS doesn't work.
Photo of Top It

Top It

  • 3 Posts
  • 0 Reply Likes

Posted 4 years ago

  • 1
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Most likely you have just taken the app's assets from the Desktop app and zipped that up for Phonegap Build, like so many did. I assume you also haven't read the Getting Started section of the PGB Docs (or any section).

Let's see: are your index.html and config.xml both in the root directory ("/") of your zip file?
Photo of Top It

Top It

  • 3 Posts
  • 0 Reply Likes
@Petra V.
I have


In the '1' zip file.
The config file is in the root directory and the index.html (and css, JS etc) is in the www folder.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Oh dear, this is even worse than I thought.
You have uploaded a full Cordova project (including directories like hooks, platforms and plugins).

You should only upload your assets and the config. The best way to do that:
- move config into /www
- adjust the paths to icons and splashes
- zip up the CONTENTS of /www, not the directory itself.

As a result, config and index are in the root of your zip, and you won't have the other forementioned directories.
Photo of Top It

Top It

  • 3 Posts
  • 0 Reply Likes
Ok I did that now and the JS files seem to work fine, but the display is still different then what I had when using the phonegap app to use my app. It's probably the CSS, but it worked fine through the phonegap app.
I'l see if I can fix it, thanks for the help! :)
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
It might be the CSS.
If the CSS is fetched from a remote server, you need to whitelist it.
If it's local CSS and used inline/embedded, you need to allow for this in CSP (depending on your device OS/version).
If it's CSS3 stuff, then be aware that Android4.x doesn't support everything. In that case use the -mozilla-properties.