How to use Android Studio SVN

How to install and configure SVN

Please refer to "Configuration of SVN in Android  Studio " directly

http://www.cnblogs.com/songmeng/p/4389446.html

How to use SVN

This article mainly refers to "AndroidStudio configure SVN and use code management"

http://www.it165.net/pro/html/201508/51801.html

text

1. Android Studio adds ignore files

Note★: For Android projects created by Android Studio, you must first add files to be ignored, and then associate with SVN. Generally, you need to ignore the following: 

  1. .idea folder
  2. .gradle folder
  3. all build folders
  4. All .iml files
  5. local.properties file

Specific steps:

How to add ignore can also refer to: http://jingyan.baidu.com/article/a378c960bd502fb32828309b.html

1. Open the Settings dialog box Ctrl+Alt+s, as shown below:

2. Start adding ignore, as shown below (3 pictures)

write picture description here

After completing the above operations, ignore is added, and the results are as follows

Link to SVN

  1. 菜单VCS—–>Import into Version Control—–>Share Project(Subversion)

    Associate the current Android Studio project with the SVN server, but the project has not been imported to the SVN server. You need to submit the project to the SVN server again after the connection is established. 

  2. Then it will pop up: select the SVN address to share and other options 
    under Define share target

    • The first option is to put the entire file directly under the trunk folder,
    • 第二个选项可以再trunk下创建你当前项目的文件夹,
    • 第三个选项在项目文件夹下有创建了一个trunk文件夹,
    • 因此建议使用第二中方式;选择完成后点击Share就可以了,会弹出让你选择SVN工作副本的格式化版本(jdk版本),如下图:

    write picture description here

  3. 点击OK等待一会就能创建本地项目同SVN服务器的关联了,成功后会自动刷新本地的项目,待项目里的内容变成绿色的即表示已经成功了,如图:

    右上角出现了SVN操作的按钮

    再次点击VCS菜单(或鼠标右键),出现了Subversion选项

  4. 到目前为止只是将项目同SVN服务器建立了联系,并没有将代码提交到SVN服务器上去,如何提交呢

    • 其实很简单,只需点击SVN相关操作按钮里的commit就行了(上图SVN相关操作按钮左起第二个按钮)

    • 当然也可以用下面的方法VCS菜单—>Subversion–>Commit.如下图:

    • 或者:选中文件或者文件夹,点击右键–>Subversion–>Commit.如下图:

三、Checkout SVN上的项目

直接看截图

write picture description here

write picture description here

write picture description here

点击yes打开,导入项目后会问你两次*iml要不要加到版本控制,选择no即可 
刚导入后会发现没有.gradle文件夹,当你运行编译一遍程序后就会出现.grandle文件夹的 
现在红色代表忽略的文件,白色代表版本控制的文件

四、Android Studio SVN代码冲突的解决

当你提交时,别人已经抢在你前面提交了一版了,你就显示提交失败,如下图:表示你的这个文件已经过期了

此时,你应该先更新,更新时提示:(有冲突)

write picture description here

点击ok

点击Merge

使用上图中的x或者>>来整理出一个最终版,点击apply就解决完冲突了

你也可以不点击merge,点击close,自己来手动处理冲突,如下图

根据实际情况改为下图代码

别忘了点击右键,标记为解决

Don't forget that the above only resolves the conflict, you haven't submitted the code after resolving the conflict, as shown below: Continue to submit and you are done

5. Browse content on SVN

write picture description here

Guess you like

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