简体   繁体   English

在Linux和Windows之间共享Eclipse工作区

[英]Sharing an Eclipse workspace between Linux and Windows

I've come to use Eclipse to develop for Android on my Windows machine for quite some time now, but more and more I've been booting up into my Ubuntu partition. 我已经在我的Windows机器上使用Eclipse开发Android已经有一段时间了,但是越来越多的我一直在启动我的Ubuntu分区。 I honestly love both operating systems as they both have their pros and cons, but I boot into each one randomly. 老实说,我喜欢这两种操作系统,因为它们都有它们的优点和缺点,但我会随机启动每个操作系统。 Anyway, I have three partitions on my hard drive. 无论如何,我的硬盘上有三个分区。 One for Windows 8, one for Ubuntu, and one for shared data (docs, pics, videos). 一个用于Windows 8,一个用于Ubuntu,一个用于共享数据(文档,图片,视频)。 But I would like to seamlessly develop on one OS and then on the other. 但是我想在一个操作系统上然后在另一个操作系统上无缝地开发。 So, my data partition should be able to hold my workspace, but I don't know if that will ruin or corrupt the .metadata and potentially ruin my projects. 所以,我的数据分区应该能够保存我的工作区,但我不知道这是否会破坏或破坏.metadata并可能破坏我的项目。 Basically my question is... are there any tips or tricks with the Android SDK, AVD, ADT, workspace, or .metadata when using them between two OS's so that it works seamlessly? 基本上我的问题是......在两个操作系统之间使用Android SDK,AVD,ADT,工作空间或.metadata时是否有任何提示或技巧,以便它可以无缝工作?

In theory, you can use two different installations of Eclipse to manage one shared workspace. 理论上,您可以使用两种不同的Eclipse安装来管理一个共享工作区。 However, you could potentially run into problems if you aren't running exactly the same version on both sides (or, if you upgrade one side but not the other). 但是,如果您没有在两侧运行完全相同的版本(或者,如果您升级一侧但不升级另一侧),则可能会遇到问题。

In practice, you are probably better off having separate workspaces on each OS, and then having a shared repository (using Git, for example) to share your code. 实际上,最好在每个操作系统上使用单独的工作区,然后使用共享存储库(例如,使用Git)来共享代码。 Not only will that work better, but you'll be using source control too. 这不仅会更好,而且你也会使用源代码控制。

People have tried that before and run into trouble, so please go with the version control solution instead. 人们之前已经尝试过并遇到麻烦,所以请使用版本控制解决方案。

The drawback is that only the project contents are shared in the version control system. 缺点是只有项目内容在版本控制系统中共享。 You will have two completely separate workspaces. 您将拥有两个完全独立的工作区。 So if you change workspace settings, they need to be changed twice (and don't even think about having .metadata under version control, that will have bad side effects). 因此,如果您更改工作区设置,则需要更改两次(并且甚至不考虑在版本控制下使用.metadata,这会产生不良副作用)。

Please be aware that several settings in Eclipse are available as workspace settings and also as project settings (eg the Java compiler version to be used). 请注意,Eclipse中的几个设置可用作工作区设置以及项目设置(例如,要使用的Java编译器版本)。 Make sure that you use the project settings and that you put the contents of the ".settings" sub directory in your projects under version control, because it contains these project settings. 确保使用项目设置并将“.settings”子目录的内容放在版本控制下的项目中,因为它包含这些项目设置。 So they are in sync between your 2 machines. 所以他们在你的两台机器之间同步。

I have been sharing workspace between linux and windows for quite some time and I only had minor hiccups. 我一直在linux和windows之间共享工作空间很长一段时间,我只有轻微的打嗝。

Here are some of the things to keep in mind, if at all something has gone wrong, and you want to try some quick fix. 这里有一些要记住的事情,如果一切都出了问题,你想尝试一些快速修复。

  • Initially you'll have to point the location of your sdk to the windows or linux path. 最初,您必须将sdk的位置指向windows或linux路径。 This would be the first error that can crop up. 这将是可能出现的第一个错误。

  • Try a clean build of the project(Project -> Clean -> Clean All Project -> Click OK) 尝试清理项目构建(项目 - >清理 - >清除所有项目 - >单击确定)

  • Check Location Path of the project (Right Click Project -> Click on Resource). 检查项目的位置路径(右键单击项目 - >单击资源)。 If it is loading from an ubuntu path (Eg: /home//Android_Projects), then you'll have to delete the project (Not from disk but from workspace) and import again. 如果从ubuntu路径加载(例如:/ home // Android_Projects),则必须删除项目(不是从磁盘而是从工作区)并再次导入。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM