1.1 ADT开发环境配置及Hello Android
Window| Android SDK Manager
除了已经被选择的项目外,再选择下面的项目。然后,单击“Install Packages”按钮。
然后,API 20创建出的AVD有些问题,需要安装下面的API 19的各种包。请参考http://stackoverflow.com/questions/24587218/android-util-androidruntimeexception-you-cannot-combine-swipe-dismissal-and-the。
等上面选择的packages都下载安装结束后,重启Eclipse。
选择Window | Android Virtual Device Manager菜单
在弹出的Android Virtual Device(AVD) Manager中,选择“Create”按钮。Target一定要选API 19。设置如下图,然后单击OK按钮。
回到AVD Manager中,选择刚才创建的AVD,然后单击“Start”按钮。在弹出的窗口中接受默认设置,然后选“Launch”。启动AVD的过程比较漫长,请耐心等待。
1.2 HelloAndroid
运行Eclipse
New |Android Application Project菜单
Next后,
Next,
Next,
Next,
Finish
一个ADT的Bug
[2015-05-26 13:48:46 -HelloAndroid] Found 2 versions of android-support-v4.jar in the dependencylist,
[2015-05-26 13:48:46 -HelloAndroid] but not all the versions are identical (check is based on SHA-1only at this time).
[2015-05-26 13:48:46 -HelloAndroid] All versions of the libraries must be the same at this time.
[2015-05-26 13:48:46 -HelloAndroid] Versions found are:
[2015-05-26 13:48:46 -HelloAndroid] Path: C:\Users\Qingxu_Li\workspace\Android\appcompat_v7\libs\android-support-v4.jar
[2015-05-26 13:48:46 -HelloAndroid] Length: 758727
[2015-05-26 13:48:46 -HelloAndroid] SHA-1:efec67655f6db90757faa37201efcee2a9ec3507
[2015-05-26 13:48:46 -HelloAndroid] Path: C:\MyTestPrograms\Android\HelloAndroid\libs\android-support-v4.jar
[2015-05-26 13:48:46 -HelloAndroid] Length:1157388
[2015-05-26 13:48:46 -HelloAndroid] SHA-1:605c447c20ca216b5556af9f215af5d4bba1b117
[2015-05-26 13:48:46 -HelloAndroid] Jar mismatch! Fix your dependencies
解决办法:
将C:\MyTestPrograms\Android\HelloAndroid\libs\android-support-v4.jar删除
然后将C:\Users\Qingxu_Li\workspace\Android\appcompat_v7\libs\android-support-v4.jar拷贝到C:\MyTestPrograms\Android\HelloAndroid\libs。
Project| Clean
重启Eclipse。问题应该就消失了。
Window| Android Virtual Device Manager启动我们创建的AVD
右键单击HelloAndoid Project,然后Run As| AndroidApplication。或者, Run | Run As| Android Application菜单。