8
votes

ant, java, node.js, phonegap, and my adobe account are all setup properly. The getting started guide says I should be able to type:

cordova create hello com.example.hello "HelloWorld"

to create a phonegap project. This does not work but following these instructions and doing:

phonegap build android

does eventually get me a .apk file. But the getting started guide tells me to open eclipse and navigate to the directory of my project and then set the subdirectory as /android. but /android does not get created when you do phonegap build android so I have nothing to work with.

How do I get phonegap to create the android directory? I am trying to finish the getting started guide instead of taking shortcuts.

3

3 Answers

15
votes

It does seem like you are using PhoneGap 3.0 and for this version, eclipse is not required (only if you want to use it for coding - compared to PhoneGap 1.0-2.x where eclipse was used to compiled the app, for the latest version it is no longer a requirement).

  1. To begin, you should use the phonegap command instead of the cordova command: phonegap create hello com.example.hello "HelloWorld"

  2. Then navigate to /HelloWorld/ folder

  3. You should see atleast these two key folders /www and /platforms. Inside /www is where you place your HTML files and codes, and /platforms/android gets generated when you compile the app with the following command: phonegap build android.

Note: Avoid making any direct changes to files inside /platforms except for config and manifest files. The other files are dynamically generated when you run the build command. All coding should take place within /www.

One more thing, use the 3.0.0 Getting Started guide.

---- February 2014 Update ----

With the release of Cordova 3.3.0, it seems the PhoneGap team is trying to address the naming confusion. The documentations have been updated to recommend people using the cordova command instead. Do not use the phonegap command anymore.

Here is a fresh installation guide for a guaranteed trouble free set up:

  1. Install Cordova (forget the name PhoneGap from now on). For PC:

    C:> npm install -g cordova
  2. From command prompt, navigate to the folder you want to create your project using:

    cordova create hello com.example.hello HelloWorld
    cd HelloWorld
  3. Define the OS you want to suppport, we'll go with Android for this example:

    cordova platform add android
  4. Install plugins (If needed). For example we want the following:

    cordova plugin add org.apache.cordova.device
    cordova plugin add org.apache.cordova.camera
    cordova plugin add org.apache.cordova.media-capture
    cordova plugin add org.apache.cordova.media
    
  5. Finally, generate the app using:
    cordova build android
    or to directly install the app to your connected device:
    cordova run android

Here is a link to the PhoneGapCordova 3.3.0 Documentation http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface

8
votes

First of all, you should be using phonegap instead of cordova to create the project folder structure.

phonegap create hello com.example.hello "HelloWorld"

enter image description here

And secondly, please note that build command uses two way to build for any specific platform. One using the phonegap build API (online) using the below command

phonegap build android

and second one locally using below command,

phonegap local build android

enter image description here

So you should try to use the second command for creating the android specific folder and use it with eclipse. You can look for more details over here http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface

When you run the build local command, android folder is created inside the platforms folder, and you should always modify the code(html, js, css) on the www folder present outside the platforms folder. The changes will get reflected once you again run the build command. This helps you maintain single code base for multiple platform ( which is the basis aim of using Phonegap)

enter image description here

enter image description here

enter image description here

Note: you need to have latest android sdk tools (vs18) to run on Android SDK.

1
votes

I have found this Multi-Device Hybrid Apps for Visual Studio Documentation for CTP1.1 Last updated: May 29, 2014 .

Some of the content from the documentation as follows.

This release supports building apps for the following device targets:

Android 4+ (4.4 providing the optimal developer experience) iOS 6 & 7 Windows 8.0 (Store) Windows Phone 8.0

Requirements: Windows 8.1

Visual Studio 2013 Update 2 - Professional, Ultimate, or Premium with the following optional features installed:

Tools for Maintaining Store apps for Windows 8 Windows Phone 8.0 SDK

Additional system requirements vary by device platform:

The Android emulator works best with PCs capable of installing the Intel HAXM driver

Windows Phone 8 requires a Hyper-V capable PC to run the emulator Building for iOS and using the iOS Simulator requires a Mac capable of running Xcode 5.1

Third Party Dependencies :

Joyent Node.js – Enables Visual Studio to integrate with the Apache Cordova Command Line Interface (CLI) and Apache Ripple™ Emulator Git CLI – Required only if you need to manually add git URIs for plugins

Google Chrome – Required to run the Apache Ripple emulator for iOS and Android

Apache Ant 1.8.0+ – Required as a dependency for the Android build process

Oracle Java JDK 7 – Required as a dependency for the Android build process

Android SDK – Required as a dependency for the Android build process and Ripple

SQLLite for Windows Runtime – required to add SQL connectivity to Windows apps (for the WebSQL Polyfill plugin)

Apple iTunes – Required for deploying an app to an iOS device connected to your Windows PC

enter image description here