PhoneGap installieren1
Vor den folgenden Schritten muss Node.js2 auf dem System installiert werden.
# install cordova $ sudo npm install -g cordova
Neue App anlegen3
# create new project $ cordova create myfolder com.mydomain.myappname MyAppName # open project folder for further adjustments $ cd myfolder # add platforms to project $ cordova platform add ios $ cordova platform add amazon-fireos $ cordova platform add android $ cordova platform add blackberry10 $ cordova platform add firefoxos
Weitere Plattformbefehle
# list installed platforms of project $ cordova platforms ls # remove an installed platform for project $ cordova platform rm android
App Erstellen4
# build phonegap app $ cordova build
Plugins installieren5
Nach der Installation von Plugins kann es zu Fehlern beim Build kommen. Um diese zu vermeiden sollte vor der Installation eines Plugins die entsprechende(n) Platform(en) entfernt werden (z.B. “$ cordova platform rm ios”), das Plugin installiert und anschliessend die Platform wieder hinzugefügt werden. Ausserdem kann die Verwendung von Plugins bei Projekte mit einem Kleinbuchstaben am Anfang des Projektnamens zu Problemen führen.6
Alle offiziell verfügbaren Plugins sind in der PhoneGap Plugin-Übersicht7 gelistet.
# example for installing a plugin (be sure to remove platform before doing so) $ cordova plugin add org.apache.cordova.device
- http://docs.phonegap.com/en/3.4.0/guide_cli_index.md.html#The%20Command-Line%20Interface [↩]
- http://nodejs.org/ [↩]
- http://docs.phonegap.com/en/3.4.0/guide_cli_index.md.html#The%20Command-Line%20Interface_create_the_app [↩]
- http://docs.phonegap.com/en/3.4.0/guide_cli_index.md.html#The%20Command-Line%20Interface_build_the_app [↩]
- http://docs.phonegap.com/en/3.4.0/guide_cli_index.md.html#The%20Command-Line%20Interface_add_plugin_features [↩]
- http://stackoverflow.com/questions/21167818/phonegap-doesnt-copy-plugin-files-to-ios-platforms-directory-during-build [↩]
- https://build.phonegap.com/plugins [↩]