5

I've a static website which purely uses only HTML5 and JS. And I have setup the phonegap in my windows 7 PC as well. My Question is what are the steps that I've to follow in order to create an android APK file out of the existing HTML/JS files. There are lot of tutorials on creating new phonegap project from the scratch. But I couldn't find any help on importing existing static website to phonegap project (please note that https://build.phonegap.com/apps is not an option for me.)

Asanga Dewaguru
  • 1,058
  • 2
  • 16
  • 31

1 Answers1

8

"And I have setup the phonegap in my windows 7 PC as well."

I'm assuming your CLI is ready for cordova development. Then it's enough to follow this tutorial/documenation.

Go to your desired directory where you want to build your project. e.g.

d:
cd d:\myworks

Then create a cordova project

cordova create hello com.example.hello HelloWorld

go inside the project directory

cd hello

And platform android

cordova platform add android

There will be a www folder inside yourProject hello->www

Delete all css js html folders inside that directory and put your static pages there.

connect your device to PC and run cordova run android

Ashesh Kumar
  • 223
  • 2
  • 12
AtanuCSE
  • 8,832
  • 14
  • 74
  • 112
  • Thanks a lot. I've tried this solution it's working fine. And I've a small query. Is it a must to stick to the folder structure inside the www folder. is it ok if I keep all the css js and HTML resources inside my own folder? – Asanga Dewaguru Jul 18 '14 at 06:12
  • you can use any structure inside that `www` folder. You can use your own folders, subfolders etc. BUT you need to keep the index.html file as it is now. just like `www->index.html` or you will need to change some settings. – AtanuCSE Jul 18 '14 at 06:40
  • that's really helpful thanks a lot again. last but not least, where exactly you can find the APK which I can used to copy to the actual device? is it in ..\platforms\android\ant-build ? – Asanga Dewaguru Jul 18 '14 at 07:27
  • check this out http://stackoverflow.com/questions/20402818/build-android-release-apk-on-phonegap-3-x-cli – AtanuCSE Jul 18 '14 at 07:47