随着智能手机的出现和普及,手机在改变时代的同时,也带动着许多行业的发展。随着移动端的火热,越来越多的人开始投身于APP开发的浪潮中。
而Android Studio作为谷歌官方Android开发工具,在移动端开发中占了举足轻重的地位。今天我们就来简单介绍下,如何将Android Studio与华为软件开发云的代码仓库进行关联开发。
首先,我们先要在电脑上分别安装好Android Studio、Git,并在华为软件开发云的代码仓库中已配置好开发相应的代码。
第一步,我们先打开Android Studio,然后在初始页面选择Check out project from Version Control,之后选择Git。
![](http://upload-images.jianshu.io/upload_images/5609636-db6b13ed299696b6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
第二步,在弹出的Clone Repository页面的Git Repository URL中,填入华为软件开发中想要拉取的代码仓库的地址。
![](http://upload-images.jianshu.io/upload_images/5609636-c5a334d5e86ff70b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](http://upload-images.jianshu.io/upload_images/5609636-1db0eb5fa42adde8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
第三步,填好URL地址后,点击Test按钮。
A:如果显示连接成功,那么直接跳到第七步。
![](http://upload-images.jianshu.io/upload_images/5609636-1c896ca8c4c6c1ad.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
B:如果显示Repository test has failed,则继续第四步。
![](http://upload-images.jianshu.io/upload_images/5609636-33ef49f7e9be81ca.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
第四步,进入华为软件开发云代码托管页面,进行密钥配置。点击“一头雾水不知如何开始?请点击这里”。
![](http://upload-images.jianshu.io/upload_images/5609636-84e20a11f60bef09.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
按照弹出页面中的指示,依次进行配置,如下图所示。
![](http://upload-images.jianshu.io/upload_images/5609636-540e25cee13ed277.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在添加SSH密钥页面,按照指示,依次进行秘钥配置。
![](http://upload-images.jianshu.io/upload_images/5609636-10bcc8a19f143376.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
生成新秘钥。
![](http://upload-images.jianshu.io/upload_images/5609636-8a2305f6d623c4de.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
复制密钥。
![](http://upload-images.jianshu.io/upload_images/5609636-bd2187175d941ecb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
将复制的密钥黏贴到华为软件开发云密钥中,如下图所示。
![](http://upload-images.jianshu.io/upload_images/5609636-745097c1bd950f27.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
第五步,配置好密钥后,再次点击Test按钮。
A:如果显示连接成功,那么直接跳到第七步。
![](http://upload-images.jianshu.io/upload_images/5609636-a96238a9f503a376.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
B:如果依然显示Repository test has failed,则继续第六步。
![](http://upload-images.jianshu.io/upload_images/5609636-88b082ca190f5a1c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
第六步,如下图所示,与华为软件开发云代码仓库建立远程连接。
![](http://upload-images.jianshu.io/upload_images/5609636-b7df9f6435dafc39.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
之后,会在.ssh文件中生成一个known_hosts文件。
![](http://upload-images.jianshu.io/upload_images/5609636-22923b79538e4575.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
第七步,在如下页面中点击Yes,即可根据华为软件开发云代码仓库在本地新建一个项目。
![](http://upload-images.jianshu.io/upload_images/5609636-902b259a5abb18e8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)