PhoneGap Build Export

Ok, previewing your app in browser is fun, but now comes the time when you want to run it on your device.

WP-AppKit supports PhoneGap Build export of your app, simply by clicking “My Project” > “Phonegap Build” > Export from your app edition in BO.
This will download a zip export to your computer that you can then upload in PhoneGap Build, which will handle your app compilation.

To learn more about how to build your app with PhoneGap Build, you can see the corresponding section in our Getting Started section.

WP CLI / Cordova Export

The basic way to export your app as a PhoneGap project in WP-AppKit is to click the “Export” button in WordPress BO.

But as from version 0.4, you can also export your app projects using the command line. This is particularly useful if you are using the CLI version of Cordova/PhoneGap to compile your apps manually on your computer (as opposed to online compilation with PhoneGap Build).

To export your app on command line, you’ll first need to have WP CLI installed in your environment.

Then you can use the WP-AppKit WP CLI export command:

wp wpak export <app_id> <target_directory> [<export_type>]


  • <app_id> is your WordPress app ID or slug,
  • <target_directory> is the directory you want your app project files to be exported to
  • <export_type> (Optional, default “phonegap-cli”) is the type of PhoneGap export you want : can be “phonegap-cli” or “phonegap-build”

You can get help about the command and its usage by running:

wp wpak export --help

Examples :

Let’s say that you’ve created a WP-AppKit app on WordPress side (slug test-app-android).

First, let’s create the PhoneGap project with PhoneGap CLI :

cd /your/path/to/phonegap/apps
phonegap create my-app
#This creates the /your/path/to/phonegap/apps/my-app directory with 
#default Cordova/PhoneGap project files
#Here you should delete the phonegap default app's www directory and config.xml
#as they're going to be generated by the WP-AppKit export.

Then you can launch WP-AppKit export when you are in your WordPress root directory (this launches a “phonegap-cli” export type by default):

cd /your/wordpress/install/root
wp wpak export test-app-android /your/path/to/phonegap/apps/my-app

This will result in the following source tree in /your/path/to/phonegap/apps/my-app :

  • hooks (Folder generated by PhoneGap CLI)
  • platforms (Folder generated by PhoneGap CLI)
  • plugins (Folder generated by PhoneGap CLI)
  • www (Folder generated by WP-AppKit export : contains your app sources/theme !)
  • config.xml (Generated by WP-AppKit export : contains the PhoneGap settings/plugins you set in WordPress BO)

Then you can build your app with standards PhoneGap CLI command :

cd /your/path/to/phonegap/apps/my-app
phonegap build android
phonegap install android

Note that it can be more convenient to do all operations from the PhoneGap app directory, without having to go to your WordPress root folder : to do so, you’ll just have to use the –path parameter of the “wp” command:

cd /your/path/to/phonegap/apps/my-app
wp --path="/your/wordpress/install/root" wpak export test-app-android .
#don't forget final dot to export to the current directory!
phonegap build android
phonegap install android

Having questions?

FAQ | Tutorials | Documentation


Contact Us