前言
Android Studio版本的更新使得开发Android 软件越来越得心应手,Eclipse+sdk这样的模式逐渐的被淘汰。接触Android是从1.0版本开始,但苦于翻墙的苦恼,一直没怎么碰,前几日,发现了lantern这个免费软件,用起来不爽,于是咬咬牙买了vpn,更新到最新版2.1。下载AS推荐官网https://developer.android.com/,或者是androiddevtools等都是可以的。安装完AS,我们需要简单的配置,从而用起来更好。
在Android Studio中 配置Genymotion
Genymotion是功能强大的Android模拟器,需要到genymotion官网下载。建议使用默认设置和路径进行安装,安装完成会在桌面生成Genymotion,Genymotion Shell以及Oracle VM VirtualBox三个快捷图标,一般仅使用Genymotion即可。
Genymotion桌面配置
1.点击Genymotion,开始配置使用Genymotion。首先要接受Genymotion的Usage notice。
2.同意之后,出现Add a first virtual device。
3.接下来,需要登录Genymotion,就用在官网下载申请的Genymotion邮箱账号密码登录。
登录来注册一个新的虚拟设备,我们可以看到登录成功时的界面如下:
5.登录成功后发现有很多的Android模拟器,根据自己的需要,选择模拟器安装。如选择Google Nexus9 -6.0.0,一路next直到Finish,可以多选择建立几个。
6.点击start按钮就可以启动了。
在Android Studio 上安装Genymotion插件
打开Android Studio,打开File->Setting->Plugins,点击Browse repositories,在弹出的搜索框中输入Genymotion,找到并安装插件。
在Android Studio中 配置Git
学习的过程中,我们可以将平时练习的项目或者创造性编写的项目上传到Github上。
安装 Git 客户端并且注册Github账号。
Git客户端下载链接为git–fast-version-control,同时需要在Github官网注册。
将Android Studio项目发布到Github
在Android Studio中新建一个项目HelloWorld
选择File ->Settings -> Version Control -> Git , 设置git目录, 点击Test测试, 如果成功会有Success提示
选择File->Settings -> Version Control -> GitHub ,设置自己的github账号, 密码, 点击Test测试, 如果成功会有Success提示
需要配置git的环境,不然上传不到Github上。如果你安装git是默认的话,需要打开C:\Program Files\Git\cmd这个目录,找到git-gui这个选项,点击打开
找到Help,点击打开里面的show ssh key,点击Generate Key,右键复制下来,然后登录到你的Github账户,找到Settings,即Personal settings ,里面有SSH keys,点击打开,可以看到有个New SSH key,点击然后直接粘贴刚才生成的key。这个是识别你的身份的,非常重要,关乎上传的成败。如果没有这一步配置git,绑定key,直接执行下一步到Share Project on GitHub,就会报错,Can’t finish GitHub sharing process
Successfully created project ‘GitHubDemo’ on GitHub, but initial commit failed:
* Please tell me who you are. Run git config –global user.email “you@example.com” git config –global user.name “Your Name” to set your account’s default identity. Omit –global to set the identity only in this repository. fatal: empty ident name (for ) not allowed during executing git -c core.quotepath=false commit -m “Initial commit xxx” –
就是因为我们没有绑定ssh key,造成无法识别你的身份,虽然Share Project on GitHub会在Github建立一个仓库,但是没有具体文件。因为没有绑定就不会将文件传到本地的git,要知道,Android Studio 的这个分享工程到Github依旧是通过Git传出的。分享项目选择 VCS -> Import into Version Control -> Share Project on GitHub, 点击之后开始设置 repository name(假如你设置过Master Password 会弹出对话框让填入密码。)
在Android Studio中 CVS下同样可以看到版本控制 Git,可以使用Git一系列操作。
如果删除Git关联, 只需要 File ->Settings -> Version Control 删掉关联即可。