First, build the development environment
1. JDK Environment variables
JDK Download
Link: http://pan.baidu.com/s/1gen1o9l Password: 8fko
Open Computer-Properties-Advanced system settings-environment variables, new JAVA_HOME system environment variables
C:\Program Files\java\jdk1. 7. 0_80
New CLASSPATH System environment variable
.; %java_home%lib;%java_home%lib\tools.jar;
Append to System environment variable path
;%java_home%/bin; C:\Program Files\java\jre7\bin
2. Install Android Studio
Link: http://pan.baidu.com/s/1mgrc7wk Password: mqn8
After the installation is complete, open Android Studio, before having the studio configuration of the first choice, this article we choose a second
Next follow the prompts, the process will be networked download/update the SDK, when finished click "Finish", Studio installed successfully
II. Preparation of the procedure HelloWorld
Open Android Studio, we select "Start a new Android studio project"
Change the name of the program to HelloWorld, and the second line remains the default (it's best to customize it so you don't have to repeat it with someone else's package name)
Tick "phone and Tablet", then select the SDK version, here Select "4.0.3", currently equipped with more than 4.0 version of the mobile phone is more than 90%, so it is compatible with most devices
Select "Add No Activity", we intend to write a helloworldactivity, do not use the default activity, click "Finish", this step will be connected to download some of the necessary things, please wait a moment to enter the studio main interface
OK, we can start to write our HelloWorld, to present a mobile phone can see the interface, we must write a class inherit from activity, the name of the class is named Helloworldactivity; in the Java directory, by right-clicking on the contents of the red box, New--java class to create our classes
After clicking "OK", enter the following code in the Helloworldactivity class
PackageCom.example.lushengduan.helloworld;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.widget.TextView;/*** Created by Lushengduan on 2016/3/4.*/ Public classHelloworldactivityextendsActivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); TextView TextView=NewTextView ( This); Textview.settext ("Helloworld!"); Setcontentview (TextView); }}
Open Androidmanifest.xml, modify its contents to the following code
<Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.lushengduan.helloworld"> <ApplicationAndroid:allowbackup= "true"Android:icon= "@mipmap/ic_launcher"Android:label= "@string/app_name"Android:supportsrtl= "true"Android:theme= "@style/apptheme"> <ActivityAndroid:name=". Helloworldactivity "> <Intent-filter> <ActionAndroid:name= "Android.intent.action.MAIN"/> <categoryAndroid:name= "Android.intent.category.LAUNCHER"/> </Intent-filter> </Activity> </Application></Manifest>
To create a new Android emulator or plug in your phone, click the run--"Run App" on the menu bar to start running the program with the following results:
At this point, our HelloWorld application is complete!!
"Lushengduan" 01, build the Android app development environment Program HelloWorld