2. hello world

        To develop an Android software, you need to prepare the tools: JDK (the core of Java), Android SDK (Android software package), development software (Eclipse, Android Studio, etc.).

        1. JDK1.7 (http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) (not the latest, enough).



Note: It should be this, English is not very good.

        2. Android Developer Tools (integrated with Eclipse and Android SDK but the version is not high, 64-bit is comfortable to use, 32-bit please choose Eclipse+ADT plug-in) (https://dl.google.com/android/adt/adt-bundle -windows-x86_64-20131030.zip).

Note: 64-bit, can not download or 32-bit, Baidu.

1. Install JDK

        After downloading JDK, click Run, Next... Install it to a certain path (eg: F:\Environment\jdk1.7), during the process, you will be prompted to install JRE, just install it directly into the JDK directory. You can also directly copy the JDK installed by others (meaning that if the JDK is not installed on the system disk, the JDK does not need to be reinstalled after reinstalling the system, just configure the environment variables).


Note: .exe is copied in later.

2. Configure environment variables

        After the JDK is installed, the installation directory is not written in the registry. Other software (packages do not include the system?) do not know its location, so it is necessary to configure system environment variables. Right-click on the computer→Properties→Advanced System Settings→Environment Variables, select Path Edit in System Variables, End to the end, enter ;(semicolon, half-width, split effect) JDK directory\bin (eg: ;F:\Environment\jdk1.7 \bin), save.


        Windows key + R (run), enter CMD, open the black background dialog box, enter java, press Enter to output multi-line information, enter javac, press Enter to output multi-line information, success.


3. Install the development software

        Android Developer Tools. Download it as a compressed package, unzip it and run it. For other development tools, please ask Baidu.


Note: Run eclipse.exe under eclipse

Fourth, build the project

        to run the software, select a working directory in the dialog box (eg: G:\workspace\android), menu File/New/Other (Ctrl+N)→Android/Android Application Project→ Enter Name→Next...Finish. Click the project name on the left to select it, the triangle arrow in the toolbar will run, and select an Android device (you can connect the mobile phone to the computer via USB, enable the debugging mode, or download an Android emulator (Hippocampus, Xiaoyao Android, etc.), it is not recommended to use the Android SDK. Emulator, note that Android Developer Tools Android SDK is 4.3, the emulator or mobile phone version cannot be too high), run.


Note: There is no response on the emulator, and it should display Hello World!

        Analysis, Hello World on the screen! Where did it come from? Check the project directory /res/layout/, there is activity_mian.xml, open it, there is a screen similar to the mobile phone as you just saw, double-click Hello World!, there is @string/hello_world, Ctrl+left-click, see Hello World! The source, modified for Hello, World! , Ctrl+S to save, click the project name on the left to select it, and the triangular arrow on the toolbar runs. How to transfer this file to the screen? The project directory /src/ has activity_mian.java (real code), setContentView(R.layout.activity_main); display activity_mian.xml to the screen (try changing the name of the .xml file?). That's it, don't ask for further explanation, I will slowly understand the mechanism in the future.

Hello World - 2016/10/18






Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326305963&siteId=291194637