I have tried using Cordova 2.4 & 2.7 to no avail. The project seems to build fine when using the create method in console, except it does not create the whole program structure. The www folder is missing (or assets?).
When I open the project in Eclipse, I can see the assets folder on the left sidebar pane, but there is no children (it is empty).
The default app builds and runs fine (it just says "Hello World, App").
I should note that I tried this in cygwin also, and it came up with an error.
An unexpected error occurred: ANDROID_BIN="${ANDROID_BIN:=$( which android )}" exited with 1
Deleting project...
I am using Windows 7 x64 with Eclipse 4.2.2, Cordova 2.7 (also tried 2.4). I have the ADT plugin installed on Eclipse, and here is a screenshot of my SDK manager.
I have the entries in my PATH variable set that I followed in the Getting Started tutorial.
If anyone has some input or ideas in how to resolve this, it would be greatly appreciated!
Hey If you are creating a project then you have to create a assets/www folder etc,You have to make changes in other files too.
Follow the link below you have all the information you need
http://www.adobe.com/devnet/html5/articles/getting-started-with-phonegap-in-eclipse-for-android.html
Be sure to change the cordova version etc,as per your requirement.
Related
I can't find something about this, I am create a cordova project with NodeJS/npm, see this link, But after create the project I will try to modify him, its like a normal thing to do.
I tryed to edit the file in:
C:\Program Files\nodejs\helloworld\platforms\android\assets\www\index.html
and run this code in console:
cordova emulate android
my files are reloading and my modifications are deleted, the application are deployed into emulator and I can't do nothing. How I can edit my project without this "reloader"? What I am doing wrong?
modify here
C:\Program Files\nodejs\helloworld\www\index.html
This modification will be automatically applied to the platform's asset folder after you build the project. And build project first before emulate
cordova build android
I'm a new user of PhoneGap. My platform is Windows 7 64 bit. I've followed the instructions on the Cordova site and have Node & PhoneGap installed. I already have Eclipse and the ADT installed from my previous work with developing Android apps with Java.
Following the steps at http://cordova.apache.org/docs/en/2.5.0/guide_getting-started_android_index.md.html I'm half way through step 4. I've successfully created the my skeletal hello world PhoneGap app. How exactly do I make an Eclipse project out of it however? The generated files do not seen to include the standard Eclipse .project file. It is not clear from the instructions which exact "new project" menu option to choose.
Thanks if anyone can help.
After creating cordova project through command line, I'm assuming you have added platform using cordova platform add android
Then to load project into eclipse, do this
Eclipse> file > import >Android >Existing acdroid code ..... > Root
directory (Browse button...... Browse to this folder
[yourcordovaproject-platforms-android] select this android folder)>
Check both your project name & cordovaLib > Finish
I figured it out. I had jumped ahead to the "create Android app." step without having run the "cordova platform add android" step first. I ran the add android step, and that did generate the Eclipse project files I needed.
I'm having some issues with the new phonegap installation, using nodejs. I've managed to get everything working, set the path to ant, android sdk, java jdk etc., everything works perfectly.
With the usage of the following commands I've managed to create a new project:
cordova create hello com.example.hello HelloWorld
However, when I've examined the project, it was empty:
So I went into the "hello" folder and added an Android platform in the following manner:
cordova platform add android
and then I've build it:
cordova build android
So, after that, there were some android specific folders, as shown below:
Is this how the structure is suppose to look like? I'm having REAL problems importing this into Android Studio. However, I managed to import the project into eclipse, but now I have two projects, first is named "HelloWorld" and the other "HelloWorldCordovaLib". This is a bit confusing. While it works, why are there two projects? Am I doing something wrong?
Moreover, when I import this project into android studio, I get a bunch of errors (whereas the same project works in eclipse): Errors with the structure
This is seems very, very confusing. I have yet to understand why Phonegap is suddenly so hard to install. I hope I'm missing something. Any kind of feedback is welcome. Thanks.
Android Studio, amazingly, can't import Android projects that don't have the Gradle project structure. Until Cordova starts generating Gradle files, or Android Studio completes the importer's types of projects it'll support, you have to export the project from Eclipse before you can import it in to Android Studio.
It's perfectly valid to have two Projects in one Cordova application. Usually, it's because your app references the Cordova project as a sort of "sub-project" (not the right term, but I'm not sure what Android calls it).
The structure is correct.
when giving the command cordova platform add android you are actually adding a folder named android inside platform folder. For android development you have to work on the files inside platforms/android.
Read more here Phonegap - Command line interface
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.
Ric is really easy to work with Phonegap and ANDROID Studio.
Here is what i am doing:
Creating Phonegap project: phonegap create testproject com.testproject.name Name;
Enter Project directory: cd testproject;
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
I'm on Mac OS X Leopard and installed the ADT plugin into Eclipse
Galileo. I followed all the steps on the Android developer SDK page to get started. My SDK version is 2.2 API 8 revision 2 and I just used the Hello World
tutorial found here:
http://developer.android.com/resources/tutorials/hello-world.html
When I first created the Android application, I saw this error in the
Eclipse console:
[2010-11-13 18:20:43 - HelloAndroid] ERROR: Unable to open class
file /
Users/mydirectory/Documents/workspace/HelloAndroid/gen/com/example/
helloandroid/R.java: No such file or directory
I commented out this line to fill in the few lines from the tutorial:
setContentView(R.layout.main);
When I ran the app, it launched my emulator but all I saw was a
vertical screen on the left that said "ANDROID" and phone buttons on
the right. I did not see the "Hello, Android" text from the
tutorial.
Any ideas?
Run project clean to force R.java generation.
Project -> Clean... -> OK
This should make the SDK to build your project correctly. Same problem happens to me pretty often with new projects.
The Eclipse ADT plugin auto-generates the R.java file based on the XML files in the res/ folder. If there's an error in one of those XML files, then the R file won't be generated. So check to see if Eclipse detects any errors in your resource XML files.