How does Android Studio use SVN for version control?

Source: Internet
Author: User

This two-day study of Android studio finally straightened out the basics of Android studio and associated operations with SVN (so that it can be used in the company's development work); Google will stop updating and supporting ADT plugins at the end of the year. The overall shift to Android studio (which is really your own kid), so it's a trend to use Android studio to develop an Android project, and the project cannot the use of Android studio; Android The basic editing operations of studio are now on the web and need to be looked at, the following is a few days of groping out of the Android studio associated SVN related operations, the time is short, if there are omissions or errors in the place to be corrected.

One, Android studio configuration svn
Android Studio Associated Configuration svn is very simple, in Settings, find version control->subversion; in the Control Panel of this page, general in the command line Client tick, then browse the local SVN installation directory, select "\svn.exe";
There is also a use system default Subversion configuration directory under the Use command line client, which is checked by default, which is the path to the SVN-related configuration information. Leave the default path on the line, there is no need to modify anything at present, the above actions such as:
<img src= "https://pic4.zhimg.com/75ae00d25fb927985d3566f727e080c3_b.png" data-rawwidth= "1038" data-rawheight= "701" class= "Origin_image zh-lightbox-thumb" width= "1038" data-original= "https://pic4.zhimg.com/ 75ae00d25fb927985d3566f727e080c3_r.png ">

Second, the Android Studio project associated with the SVN repository and add ignore files
to create a new Android project in Android Studio, we will first add the files to be ignored and add the ignore files to the eclipse in Android studio. When we add ignore files on Eclipse, it's OK to add the Ignore file before the SVN is not associated with it (try to ignore the file successfully for many times). )。 Android Studio Add ignore file is also in Settings->version control (with versioning-related settings in this directory) under ignored files, click the plus sign to ignore the file settings, Android Studio defaults to three ways for developers to choose: Ignore the specified file, ignore all files under the folder, and ignore files that match the matching rules: <img src= "https:// Pic3.zhimg.com/3abf586a554dc9faedb1f3bac326fbae_b.png "data-rawwidth=" 1038 "data-rawheight=" 701 "class=" Origin_ Image Zh-lightbox-thumb "width=" 1038 "data-original=" Https://pic3.zhimg.com/3abf586a554dc9faedb1f3bac326fbae_ R.png ">
click on the "+" button on the right to add, "-" Delete, Android studio created Android project generally need to ignore. Idea folder,. gradle folder, all Build folders, All. iml files and local.properties files.
After ignoring the file, we have the project associated with SVN, choose Vcs->import into Version control->share project (Subversion); Version control has import into Subversion and share project (Subversion) two options: The first one is to import the project directly onto the SVN server, but this local project is not associated with the SVN server , all the files in the project will turn red after the import, and will be prompted to submit to the SVN server that the project is not a working copy of SVN, and the second is to associate the current project of Android Studio with the SVN server, but does not import the project to the SVN server. The project needs to be submitted to the SVN server again after the connection is completed. Both ways can implement the ability to submit local code to the SVN server, but the steps are different, first to complete the second way of the project with the SVN Association and Code submission, the first kind of seemingly irregular, and then again; the second way to associate a local project with SVN: <img src= "Https://pic3.zhimg.com/d192e4e066db44c21cf0bbd4e5519e66_b.png" data-rawwidth= "1071" data-rawheight= "531" class= "Origin_image zh-lightbox-thumb" width= "1071" data-original= "https://pic3.zhimg.com/ D192e4e066db44c21cf0bbd4e5519e66_r.png ">
you will then be prompted to select the SVN address and other options you want to share, such as: <img src= "Https://pic4.zhimg.com/9d3318455907d64cb362be57239504eb_ B.png "data-rawwidth=" 479 "data-rawheight=" 670 "class=" Origin_image zh-lightbox-thumb "width=" 479 "data-original=" Https://pic4.zhimg.com/9d3318455907d64cb362be57239504eb_r.png ">
under Define share target Select the second can be under the trunk to create your current project folder, the corresponding first option is to put the entire file directly under the Trunk folder, the third under the project folder has created a trunk folder, It is recommended to use the second method; Click Share when you are done, and the formatted version (JDK version) that lets you select the SVN working copy will pop up, such as: <img src= "https://pic1.zhimg.com/ 8d68fff6f283a0e6fe87c9b9ff4a48ac_b.png "data-rawwidth=" 812 "data-rawheight=" 379 "class=" origin_image Zh-lightbox-thumb "width=" 812 "data-original=" Https://pic1.zhimg.com/8d68fff6f283a0e6fe87c9b9ff4a48ac_r.png " >
recommended choice of 1.8format, I chose the other before the test, found that the project always reported a mistake, the reason is not found, so choose it first; Click OK to wait a while to create a local project associated with the SVN server, the successful regret automatically refresh the local project, the content of the project to become green means that has been Succeeded, as shown: <img src= "Https://pic3.zhimg.com/339bc1ad0ab4ebcdd6fe938dde3bb886_b.png" data-rawwidth= " 978 "data-rawheight=" 480 "class=" Origin_image zh-lightbox-thumb "width=" 978 "data-original=" https://pic3.zhimg.com/ 339bc1ad0ab4ebcdd6fe938dde3bb886_r.png ">
So
far just the project with the SVN server, and did not submit the code to the SVN server up, how to submit it, it is very simple, just click on the SVN related action button in the commit is OK (SVN related action button to the left of the second button); & Amp;lt;img src= "Https://pic3.zhimg.com/d16f608e9c18c66f8636c9d97345da72_b.png" data-rawwidth= "1173" data-rawheight= "1046" class= "Origin_image zh-lightbox-thumb" width= "1173" data-original= "https://pic3.zhimg.com/ D16f608e9c18c66f8636c9d97345da72_r.png ">
after clicking Commit, Android Studio will parse the current code into code, if there is an error or warning will pop up the following box, if there is an error conflict, etc. need to be resolved before committing, if the warning can be ignored (same as Eclipse) , the first time the entire code is submitted to the SVN server is likely to be long, please wait patiently, and then create the project not so slow. <img src= "https://pic3.zhimg.com/60d295e5623fcb407fc517916aa3eeea_b.png" data-rawwidth= "316" data-rawheight= "187" class= "Content_image" width= ">"
after the success we completed the new project with SVN and the link to the project to the SVN server.
The first way to do this is to remove the local code after importing the local code into the SVN server and then update the previously submitted code from the SVN server so that it can be developed with the SVN connection. The first approach differs from the second one in that the first is to commit the code to the SVN server before it is updated from the SVN server (the local project is connected to the SVN server), and the second is to contact the SVN server supervisor and then submit the code to the SVN server. It is recommended that you use the second method for SVN correlation of new projects.

Third, the Android Studio SVN code conflict Resolution
for the problem of code conflict resolution, first of all, thank you for your friend Shinchven's answer suggestions. When using SVN to update the code on the server, sometimes a code conflict dialog box pops up asking if you are merging, and offers three merging scenarios: Accept yours (using your), accept theirs (using others), and merge (merging);
<img src= "https://pic2.zhimg.com/bcfe7bf54eb872e71b94c35bcfbe405d_b.png" data-rawwidth= "610 "Data-rawheight=" 537 "class=" Origin_image zh-lightbox-thumb "width=" 610 "data-original=" https://pic2.zhimg.com/ Bcfe7bf54eb872e71b94c35bcfbe405d_r.png ">

The first two are all covered operations, there is no more explanation; When you choose Merge Merge, the Code Merge control window pops up, a total of three screens, the left and right sides when you and the server different code and highlight the different parts, with arrows and fork number, By clicking on the arrows to add conflicting code to the middle of the merge area, click on the fork to identify the piece of code to discard, and after all the conflict processing is complete, merge succeeds. <img src= "https://pic2.zhimg.com/35c1911d7ec78302853050d7c7a02f45_b.png" data-rawwidth= "640 "data-rawheight=" 503 "class=" Origin_image zh-lightbox-thumb "width=" 640 "data-original=" https://pic2.zhimg.com/ 35c1911d7ec78302853050d7c7a02f45_r.png ">
posted 2015-07-2,239 Reviews ThanksShareCollection • No help · Report• Author reserves the right to collect User-aware , using: Xperia/android/osx/ios/ubuntu/ce ...Shong, users agree Check out from server 1, checkout from Subversion2, Project check out after open Build.gradle opened Project 3, Project opened in the top VCs inside Enable version control Select Subversion to submit to server Vcs-import into subversion before work to get home, and at night to fill out all the check out from the server
1. Checkout from Subversion
<img src= "https://pic3.zhimg.com/48b00247d9b7ac321b805f2eb958359a_b.png" data-rawwidth= "324" data-rawheight= "407" class= "Content_image" width= "324" >
2, the project check out after opening open Build.gradle project
3, the project opened in the top VCs inside the Enable version control to select Subversion

Submit to Server
Vcs-import into Subversion

I wrote before work and hurried home, and then I mended it at night.

Xiahailiang
Links: http://www.zhihu.com/question/32298079/answer/56010423
Source: Know
Copyright belongs to the author. Commercial reprint please contact the author for authorization, non-commercial reprint please specify the source.

How does Android Studio use SVN for version control?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.