问题
I've got a Phonegap/Cordova 3.0 app that I am testing on Android.
Since version 2.x, Cordova relies heavily on the command-line terminal. I've done all the setup stuff and I can build the app. But two things are troubling me.
First of all, an Android project has two www folders. One is [myproject]/www. The other is [myproject]/platforms/android/assets/www. I'm not sure which of these folders to edit when I am fixing bugs.
If I am correct, the first one is where you place your app files before using the command-line "cordova build" to create the app. The second one should then be only a copy that's used after building, before deploying.
Now my question is, when I make a change to my app and I want to test on device, do I have to use the command line to (re)build the app every time?
回答1:
[myproject]/www
is the directory in which you should put your source files. When you build your app these files are copied in to [myproject]/platforms/[platform]/assets/www
. In addition to this, files in [myproject]/platforms/[platform]
are also copied to [myproject]/platforms/[platform]/assets/www
, which allows you to create per-platform overrides to your files.
Note that you should never edit files in [myproject]/platforms/[platform]/assets/www
directly, as they will be deleted next time you build your project.
To run your project on your device use cordova run [platform]
, or to run it on an emulator use cordova emulate [platform]
.
回答2:
I found a solution: in command-line terminal, type cordova run android
and the app will be built, deployed and run on device.
回答3:
Hi First thing : Edit www folder inside the asset folder. Second : no need of command line build , you can take build via eclipse its very easy, Right click on project root folder --> Run As -> Android Application
来源:https://stackoverflow.com/questions/18459334/deploying-phonegap-cordova-app-for-android