Eclipse can't create project from existing code android - android

I've created by command line a new phonegap application.When I try to get it by eclipse from android existing code it can't recognise as a android project.
Have I build my phonegap app before?
Phonegap project's folders are:
.cordova
hooks
merges
platforms
plugins
www

phonegap create [optional params] will setup a blank project space. To add platforms to this project you must run phonegap platform add [ios/android/wp8]. Then depending on the platform and how you wish to develop it, you run either phonegap prepare or phonegap build.
In your case, since you wish to import to Eclipse, you will want to run:
phonegap platform add android
phonegap build
Then in Eclipse you can browse to /PROJECT_PATH/platforms/android and import your project.

Related

PhoneGap Development

How easy is PhoneGap to build and deploy Android applications? The application I'm thinking of is not a beginner level app. How is the level of debugging and error handling and the support it gives?
Thanks in advance.
Deploying an app with Phonegap is quite easy. You can install Phonegap by using,
npm install -g phonegap#latest
and then create an app by,
phonegap create myApp
Refer the docs, PhoneGap Getting Started
When you create the app you will notice there is a directory called "WWW". All you have to do is copy a build of your existing web app to this directory.
All your assets and code in this directory will be used to build apps for the platforms you specify.
You can use Cordova to add the Android platform, which will be used to get an Android build out of your project.
Use,
cordova platform add android
Notice the directory "platforms". Inside it you will find another directory called "android" and this will be your Android project.
To build an Android app simply use,
phonegap build android
When you run the above command Phonegap will build an Android project using your code in WWW directory and place it in the platforms/android directory.
You can then use Android Studio to open the android directory which is an Android project now.
It's as simple as that and quite easy once you get the hang of it.
Then you can do all the regular debugging inside Android Studio using Logcat.

Embedding cordova application on Android native application

What I'm trying to do is embed a cordova application into a native android application.
It seems to me that the documentation is out of date or not clear about the steps that needs to be done.
Documentation:
https://cordova.apache.org/docs/en/latest/guide/platforms/android/webview.html
I am at the point that I can't create the .jar file for the following reasons.
I don't have a /framework directory in my root project directory or in platforms/android
Cordova seems to be using gradle instead of ant for building the android project. I can't find a build.xml anywhere in the android project.
My Cordova version: 8.0.0
As as followup question, I expect this .jar file will also contain the plugins that the cordova project depends on, correct?

Where to place jars in Cordova app developed in Visual Studio?

I am trying to create cordova app in visual studio, because I just want to explore. I have very good idea on Cordova CLI, eclipse and Android Studio environments. My goal is to add my own custom plugin to the Visual Studio Cordova project and execute my existing code.
With the help of below link, I successfully added my custom plugin.
https://taco.visualstudio.com/en-us/docs/manage-plugins/#Custom
Apart from js files, my custom plugin also needs some native(android) jars, which I am going to add manually in Eclipse/Android Studio.
My problem here is - I don't find any libs folder in Visual Studio environment (as I am newbie), can some one let me know where exactly I need to required jars.

How to upgrade from phonegap 2.9 to phonegap 3.5 (project directory could not be found error)

I have an android application that i built on PhoneGap 2.7.I installed phonegap 3.5 using cmd and tried to upgrade an app as shown here
How do I upgrade Phonegap in my Phonegap app?
But when i do it using cmd it gives me the following error:
Unlike phonegap 3.5 the android application that I built in PhoneGap 2.7 does not have a platform folder.So what am I supposed to?and how can I verify if it is upgraded or not?
I had also seen these phonegap documentation
http://docs.phonegap.com/en/3.5.0/guide_platforms_android_upgrade.md.html#Upgrading%20Android
But It does not show how to directly upgrade from 2.7 to 3.5
I don't think phonegap platform update works for upgrading from something older than 3.x.
For phonegap/cordova cli to work it has to detect a project with the structure of 3.x projects.
To upgrade your project in 2.x you have to
install phonegap or cordova cli (which you seem to already have done, but if you don't plan on using phonegap build, I suggest you use
cordova instead of phonegap. if not please replace cordova by phonegap
in next steps)
open a cmd and cd to a folder in wich you will want to put your project
create the new project from the www folder you had in your old project:
cordova create nameforprojectfolder com.test.app Testapp --copy-from=pathtooldwwwfolder
change current dir to the newly created folder
add the android platform:
cordova platform add android
in cordova/phonegap 3.x no plugin is added by default so you will have to add all the plugins you use :
cordova plugin add uri.of.plugin
customize config.xml to your needs
build the android project (this will create files in the platforms/android folder)
cordova build android
You may need to customize AndroidManifest.xml in platforms/android/AndroidManifest.xml
Now you can use the CLI to work with your project.

cordova create VS cordova-ios/bin/create

On OSX I want to create a PhoneGap app to run on iOS and Android.
I installed cordova (3.0.0) and phonegap (3.0.0-0.14.0) using npm.
Following the CLI guide I can create my app using
cordova create hello com.example.hello HelloWorld
then add platforms
cordova platform add ios
cordova platform add android
It works well but I'd like to use XCode as IDE. I read the IOS platform guide and saw I can create my app using
./path/to/cordova-ios/bin/create /path/to/hello com.example.hello HellowWorld
I can't execute that command if the folder already exists, so I removed it first. I then tried adding android to it but it doesn't work (Current working directory is not a Cordova-based project.). I then noticed that the content of the directories are really different depending on the tool used.
Is there an easy way to create an XCode project and still be able to use the CLI to build for Android and iOS?
I was able to create a project for ios using the CLI against the bin directory of the ios platform as in your example EXCEPT, I had to create an empty folder first. Try this..
./create ~/My-Project/name of empty project folder com.example.appname. "Project Name"
You can:
create a project using cordova create projectname
add ios support with cordova platform add ios
navigate to projectname/platforms/ios and open the .xcodeproj file in XCode
to use XCode as the IDE.
cordova platform add ios uses the create script under the covers.
The issue you will run into is that if you make changes to the html, css, or js files under projectname/platforms/ios, you will have to manually push those changes back to projectname/www. Or you can only make changes to projectname/www and use cordova prepare to push them to your ios directory (and your android directory).
You'd also need to decide how you want to handle version control--will you do it yourself with a command line client, or within your IDE?

Categories

Resources