3
votes

I am developing a cross-platform app with Phone Gap, Jquery Mobile in Android using eclipse. I am not at all using any PhoneGap functions in my app. My purpose with PhoneGap is to build native apps for ios, Android, windows etc from Adobe PhoneGap build service. Under android assest/www/ folder I created multiple sub folders like css,js,html etc, where I put my jquery mobile html,css,js files and my custom js,html,css. Note under www directory I have cordova.js and index.html, cordova jar also included in build path. My app is working fine, when I run it in eclipse + Android emulator. It is generating valid apk and opening my app root page welcome.html, which is under www/html/welcome.html. The problem is when I generated android build by uploading my code to Adobe PhoneGap Build service, it is giving valid apk, which after installing opening index.html, which is under www/index.html. I my DroidGap actvity, i am loading welcome.html only.

  super.loadUrl("file:///android_asset/www/html/welcome.html");

any suggestions plz. I need to have multiple html pages and folders under www directory because some design restrictions.

5

5 Answers

2
votes

I am not sure if I uderstood what you mean.

Perhaps you could try:

$.mobile.changePage('./html/welcome.html');

Add this to your javascript event's listener, it should work.

1
votes

For Phonegap Build to work, all your generic src files need to be in www of the base directory. Any Android specific files go in /www/res/android or /merge. See phonegap and/or codrova documentation.

One of the problems with using Eclipse and Phonegap together is that if you imported your project as an existing Android project, then all work you do is in the Android platform directories, not www.

Main reason why I now use Netbeans with Phonegap 3.0 CLI:

In terminal:

  • phonegap create [project dir name]
  • cd [project dir name]
  • phonegap local build android
  • add plugins
  • replace generic phonegap /www files with your project specific files & dirs

In netbeans IDE:

  • new project -> html5 -> use current src code
  • tweak /www/context.xml app name, ......
  • .......

In terminal:

  • adb connect 192.168.1.??? [Android-X86 in VB guest]
  • adb devices [are devices showing?]
  • phonegap local run android [build and installs to VB Android-X86 guest]
  • debug ....
  • phonegap remote build android [use Adobe Phonegap Build]
  • .......

Note: new Netbeans 7.4 RC2/Development includes Cordova development. Tried, but while has some interesting features, seemed to include the kitchen sink when doing initial build. Very slow to compile. Disabled feature. Also background scanning chokes. Turned off with plugin, but remember to manually rescan project files, especially if did work outside IDE. Couldn't set up Android-X86 in VB as my emulator. Why I use the above workflow.

Peter

0
votes

By default the index.html, or in this case, welcome.html, should be located in the root of the www directory. Since it is not the case, you could try to add the following tag in your phonegap/cordova config.xml file

 <content src="html/welcome.html" />
0
votes

my suggestion is that you copy all the contents of welcome.html to www/index.html and let the default super.loadUrl("file:///android_asset/www/index.html"); as it is.
you can later switch views using window.location.href='html/anypage.html';

-2
votes

i have the same kind of problem. i am converting my html website files in android studio. so, under the assets i paste my website folder.. how can i run all the html files i imported? i used the code webView.loadUrl("file:///android_asset/anamayyy/main.html"); and it only shows the main html. the links that i used as button doesnt work..

the links as buttn for next page doesnt show(webpage not available