Android Development-hello World+phonegap (Cordova)

Source: Internet
Author: User

Think of the iOS program on Android, try Android development, the results found that the Android development environment is not easy to get. Next, the entire process is recorded, and the familiar actions are no longer mentioned, focusing on the individual's particular experiences:

First, install Java, Eclipse (64-bit Luna4.2.2), operating system Win7

Second, install ADT, you can install ADT (Baidu) in Eclipse, download the Adt-23.0.6.zip file and unzip it locally to the Eclipse directory.

Third, install the Android SDK (Installer_r24.1.2-windows.exe), after installation in the SDK manager has the Android SDK Tools 24.1.2, other temporarily.

Install Android SDK Platform-tools and Android SDK Build-tools, can copy folder mode installation, or the. zip file (Find the appropriate link with a thunderbolt will be faster) placed in the temp directory and then click the corresponding package for installation, the most recommended online installation, slow.

Install the appropriate API (or Android version platform) and Android system image. I installed the API19 and API22. You can package by version, or copy a folder to install, or use the temp directory to have SDK Manager installed, or installed online.

Install HAXM Revision (version 5.3) to accelerate the virtual machine under Intel chips.

  Need to insert a few words: The Android SDK has several components, corresponding to several directories, you need to be aware of the ADT version and SDK tools version to correspond, otherwise the project error may occur:

24.1. 2   corresponding directory tools (version unique) Android SDK Platform-tools corresponding directory platform-tools (version only) Android SDK build-tools          Corresponding directory build-tools (multiple Versions) Android API                      corresponding directory platforms (multiple versions) Android image corresponding Directory system-images (multiple versions)
HAXM and other corresponding directory extra

In this, you can use Eclipse to develop Android programs. Next is the installation of PhoneGap (Cordova), phonegap2.9.1 after the change is called Cordova, is now Cordova4.3. The following is also called Cordova Bar. Online a lot of 2.9.1 used to be in Eclipse directly import jar package, JS file can use PhoneGap, but after upgrading to Cordova, must online new Cordova project, this is very annoying.

Seven, install Nodejs, some places say to be installed ant, I do not know whether must, but I installed. Nodejs is a 64-bit installation (Node-v0.12.2-x64.msi) with NPM, which then installs Cordova and new projects, adding platforms.

Eight, install Cordova, here need to say, the online introduction is the implementation of NPM Install-g Cordova. I do not use the G parameter, the Cordova installed directly into the Nodejs\node_modules directory (it is said that with the G parameter is a global installation, do not understand, and did not try). In addition, the beginning of the execution of the command has been stopped in that, nonstop turn ah turn, at first thought is the network slow, delayed a lot of time, later found is the authority problem, then to the directory to get super User rights, with super User run cmd, and then use NPM installed, you can

IX. Create Cordova Project: Cordova Create hello Com.example.hello "Hello World". This step to the network, may be slow, will be in the current directory to generate a Hello directory, it is not available at this time, need to add the platform you need, Android or iOS, etc.

Add platform, go to Hello directory, execute Cordova Platform add iOS or Cordova Platform add Android, and of course, there are other platforms such as WINDOWS8.

Xi. Import an Android project into eclipse: in File->new->project->android-android project from Existing Code. Locate the Hello directory. Two items will be out of the import: Hello and Mainactivity-cordovalib

12, at this time the project should have errors, can not compile I met the main two, one is the Android platform problem, with UE to modify two items about TARGET=ANDROID-XX configuration, the xx for me before the 22. The other is that the Cordovaactivity class that has been defined in Mainactivity-cordovalib is not found in the Hello Project, which requires a reference to the mainactivity-cordovalib in the Hello Project, The practice is to add a link source to the MAINACTIVITY-CORDOVALIB\SRC directory in the Source tab of the Java Build path in the Hello Project properties.

At this point, you should be able to compile and use the virtual machine to run Hello World. The next step is to add their own code in the ASSET\WWW, note that follow the instructions in the _where-is-www.txt file to change the configuration, or import the WWW file into the project.

13. Export APK: Right click on the Hello Project, choose Export->export Android Application ..., which need to use a keystore, the first time you can create a new one. No research on what KeyStore is.

The next step is to focus on the work of H5, Mobile jquery and business content.

Android Development-hello World+phonegap (Cordova)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.