How to Use TFS in Android Studio

2019-02-20 14:21发布

问题:

I want to use TFS in Android Studio. I installed Visual Studio Team Services and then in TFVC of Settings, i should to select TF executable file, i downloaded TFE of below link but when i Test TF exe file, i give below error.

The specified path does not lead to a valid TF executable.

Downloaded link:

https://github.com/microsoft/team-explorer-everywhere/releases

How can solve this problem?

回答1:

Please double check if you have follow below steps:

You must have the TF command line tool installed to be able to use TFVC features. The minimum version supported by the plugin is 14.0.3. To install the tool, download the latest "TEE-CLC-14...zip" file and extract it to a known location. After extracting the files, you must accept the license agreement. To do so, open a Command Prompt/Terminal window, navigate to the extracted directory, and run tf eula. After reading the EULA, enter y enter code hereto accept it. NOTE: If you forget to do this, the plugin may fail to load with a RuntimeException.

For the tool to be detected by the plugin, you must set the location of the executable in the Settings/Preferences menu by following these instructions:

  1. Go to RD Settings Version Control -TFVC
  2. In the Path to tf executable text field, navigate to the location of the tf executable.

  3. Click Test to test that the executable has been found and is working as expected.

  4. Click Apply then OK to save and exit.

More details please refer this tutorial.



回答2:

I had to do a couple of things to make this work.

I was following this video and it selects 'tf' as executable. I'm using Windows so I had to select tf.cmd as executable. Getting Started with TFVC inside of Android Studio with the Team Services Plugin

Also I had _JAVA_OPTIONS set in environment variables so when Android Studio was testing tf executable, the first response was:

Picked up _JAVA_OPTIONS: -Xms512m -Xmx2048m

After I removed _JAVA_OPTIONS from environment variables tf executable was accepted.

Going through debuglog Android Studios debuglog was pretty useful to understand the issue: How do I collect logs to help troubleshoot an issue?

Also I ended up modifying tf.cmd according to this. Seems to work so I'm going to let it be. https://github.com/Microsoft/vso-intellij/issues/45

This was due to the heap memory. By default there in the tf.cmd you are starting the tool by requesting a heap of 2048MB. This is too much for certain machine (as in my case). I changed the -Xmx param to 512 and now is all working fine.