Creating a Phonegap based Android ap in Android Studio

13,324

Ric is really easy to work with Phonegap and ANDROID Studio. Here is what i am doing:

  1. Creating Phonegap project: phonegap create testproject com.testproject.name Name;
  2. Enter Project directory: cd testproject;
  3. Add Android platform: phonegap build android;

You have your phonegap project ready. Now open Android Studio. Select Import project and follow instructions. If you don't have any plugins added in your project it's preaty pushing NEXT till you get to the end.

That's all. If you need more information tell me will be happy to help you.

If you prefer snapshot you can find a very easy to follow tutorial here: Phonegap and Android studio

Share:
13,324
Ric
Author by

Ric

I'm a senior LAMP web developer specialising in eCommerce, and I'm the proprietor and company director of QWeb Ltd, a web design and development agency in Leeds. QWeb provide a full range of services including web design and development, eCommerce, hosting, email marketing, social media and search engine optimisation. We'll continue to support you with ongoing maintenance and advice to keep your business at the forefront of the dynamic digital market place. We'd love to hear from you.

Updated on June 08, 2022

Comments

  • Ric
    Ric almost 2 years

    I've dabbled with Phonegap using Eclipse and the ADT plugins in the past and I'm now trying to get my head around doing this in the new Android Studio IDE.

    Since Phonegap v3 seems to rely on some kind of NodeJS commandline installation thingy, of which I know absolutely nothing about, I've downloaded Phonegap v2.9 instead. Also since Android Studio is so new and the documentation seems to only cover importing existing Eclipse projects or projects built using Phonegap's commandline, I'm instead trying to follow old Eclipse documentation.

    To get to the point, I've created a project in Android Studio and verified that it runs. I've then created /assets/www and copied cordova.js and a basic index.html file in. I've copied cordova-2.9.0.jar in to /libs and right clicked to 'add as library'. Finally, I've amended MainActivity.java and AndroidManifest.xml accordingly.

    The problem though is that when the build gets to 'import org.apache.cordova.*;' in my MainActivity.java file, it's erroring out with 'Gradle: package org.apache.cordova does not exist'.

    Could somebody please point me in the direction of some documentation on creating a Phonegap ap using Android Studio (rather than importing in from Eclipse or from something created via Phonegap commandline), or even just describe how I'm supposed to edit the build.gradle file so that Gradle can find Cordova?

    Much appreciated.