Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cordova/phonegap does not make android directory

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.

like image 230
user1873073 Avatar asked Sep 20 '13 18:09

user1873073


People also ask

What is difference between PhoneGap and Cordova?

The same is true here: Cordova is the open source version of the framework, while PhoneGap is the Adobe-branded version. In the end, there is little difference between the two efforts. There are some slight differences in the command-line interfaces, but the functionality is the same.

Is Cordova outdated?

Apache Cordova Is Retired: Alternatives for Cross Platform Mobile Development in 2022. Future trends of cross-platform mobile development are already starting to emerge, and it appears that Apache Cordova won't be included in the list of frameworks that power hybrid web apps for mobile devices.

Does Cordova need Android studio?

Cordova-Android requires the Android SDK, which can be installed on either macOS, Linux, or Windows. For the base system requirements, see the Android Studio's System Requirements.


2 Answers

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

like image 139
James Wong Avatar answered Nov 11 '22 09:11

James Wong


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.

like image 24
Ashis Kumar Avatar answered Nov 11 '22 08:11

Ashis Kumar