Current location - Quotes Website - Signature design - How to package html with phonegap
How to package html with phonegap
PhoneGap's online packaging size is limited, and packages over 30M cannot be packaged online. Of course, you can take pictures and sound files out of your bag and pack them. After downloading, unpack, repackage and sign. It's quite troublesome.

The simple method of local packaging is as follows:

Download and install the Java environment.

Open ADT and create a new Android application.

Enter a name or something, and then you can go all the way.

You can choose the project location, and my location is the default location.

You can select the icon here.

Choose the first one.

At this time, an Android project was established. Run at this time, you will see the default appearance, ignore it.

Copy the jar file in the android directory under the PhoneGap directory to the libs directory of the project.

Copy the xml directory to the res directory of the project.

Under the assetc directory, create a www directory and put the html content below. In order to be lazy, I copied the contents of the phonegap example.

Modify Java code:

[java] View Plain Text

Package com.myexample.helloworld;

Import android.os.bundle;

Import org.apache.cordova. *;

Common class main activity extension DroidGap

{

@ Overlay

Public void once created (bundle saved instant state)

{

super . oncreate(savedInstanceState);

//by & ltcontent src="index.html" />. In config.xml

super . loadurl(config . getstarturl());

//super . loadurl(" file:///Android _ asset/www/index . html ")

}

}

/*

* The following is the code generated by adt, please comment it out.

Import android.os.bundle;

Import android.app.activity;

Import android.view.menu;

Public class MainActivity extends Activity {

@ Overlay

Protected void oncreate (bundle saved instancestate) (

super . oncreate(savedInstanceState);

setContentView(r . layout . activity _ main);

}

@ Overlay

Public boolean once creation menu (

//Expand the menu; If the action bar exists, this will add items to the action bar.

getMenuInflater()。 inflate(R.menu.main,menu);

Return true

}

}*/

Modify AndroidManifest.xml in the project root directory and config.xml in the res/xml directory.