Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up phoneGap environment under Andriod

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to set up the phoneGap environment under Andriod", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to set up the phoneGap environment under Andriod" article.

PhoneGap is an application development platform that allows you to easily call the local API interface and publish applications to stores using HTML5. Officials say it has the advantages of low cost, low development cycle, lightweight and so on, which we can't prove for the time being. But there is a cross-platform, but it is a very obvious advantage. Because it uses the HTML5+JavaScript model to develop applications. PhoneGap uniformly encapsulates the native api (Andriod,IOS,WP8/7,WINRT) of several major platforms with JavaScript. In this way, to migrate from one platform to another, you just need to take the HTML code and JS intact and package it. PhoneGap was later acquired by Adobe and then contributed to the open source community, which is now managed by Apache and renamed cordova.

1. Download phoneGap

Extract it and find the lib/android directory.

two。 Create a new Andriod project under eclipse, which is the same as a normal project.

3. Create a new folder "www" under the assets directory

Copy the cordova-2.6.0.js from the lib/android directory to this directory. Copy cordova-2.6.0.jar to the libs directory.

Image

4. Create a new html file index.html in the www directory. Our interface is going to be built here.

Image

The code for index is as follows:

Copy the code

The code is as follows:

HTML5Paint

Alert ("HELLO CORDOVA")

HTML5Paint

5. Copy the whole xml folder under the lib/android directory to the res face

Image

6. Modify AndroidManifest.xml to add user rights

Add the following code to the front of the tag

Copy the code

The code is as follows:

7. Modify MainAcivity.java

Copy the code

The code is as follows:

Public class MainActivity extends DroidGap {

@ Override

Public void onCreate (Bundle savedInstanceState)

{

Super.onCreate (savedInstanceState)

Super.loadUrl ("file:///android_asset/www/index.html");"

}

}

There will be an error in 8.build because the previous cordova-2.6.0.jar was not added to the buildpath. Add buildpath.

Image

Go on, build will pass.

Finally, run:

Imageimage

Such a phonegap Andriod program is done. Transplant yesterday's HTML5 drawing board tomorrow.

The above is about the content of this article on "how to set up a phoneGap environment under Andriod". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report