Android环境搭建和HelloWorld编写

来源:互联网 发布:如何将mac的日历退出 编辑:程序博客网 时间:2024/04/28 06:50

这几天实习有点空闲,偷点时间体验android,哈哈


一直从事后台开发,所以可能对java掌握的还算不错,对入门android也是很有帮助的




android环境搭建


1、JDK、Eclipse

一般从事Java开发的朋友,都会有自己的jdk,eclipse,这里就省略了,我这里用的是jdk1.8,eclipse3.7


2、Android SDK

Android SDK 官方下载地址:http://developer.android.com/sdk/index.html

下载EXE安装文件,安装后在安装目录会有一个SDK Manager.exe的文件,点击选择自己想安装的sdk版本,进行install



3、Eclipse 插件ADT安装

help-》install new software

插件地址https://dl-ssl.google.com/android/eclipse/



4、配置SDK路径



5、虚拟设备AVD安装

windows-》Android Vitural Device Manager


具体配置可以参考一下



OK,至此android开发环境已经搭建好了



Android HelloWorld


1、创建项目

file-》new-》Android Application Project


next->next



next->finish,项目默认会添加活动MainActivity,至此项目创建完成


2、运行Android项目

Run as -》Android Application Project

记得要先创建和项目对应版本的虚拟设备AVD,比如我们这里用的是SDK4.4



好的,这里就看到Hello World了,而这个Activity的布局定义在activity-main.xml下

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context="${relativePackage}.${activityClass}" >    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="@string/hello_world" /><!--这里只是引用外部配置,你可以写Hello World!--></RelativeLayout>


好吧,总之,Android还是挺好玩的,入门也是挺简单的


0 0