如何在多个平台上管理Android / Eclipse / Git项目?

时间:2022-06-05 07:26:24

I'm working on an Android group project, and have been running into issues with Eclipse's .metadata folder and git.

我正在开发一个Android组项目,并且遇到了Eclipse的.metadata文件夹和git的问题。

Originally, I didn't include the .metadata folder, which caused one teammate's eclipse workspace to completely break. The projects wouldn't show up in the package explorer, and the SDK couldn't be found. I am working under OSX and they're on Windows. So then I included the .metadata folder, and that fixed the problem with the projects not being found, but the commits are a nightmare! There are always thousands of insertions/deletions and the SDK is found, but it points to the wrong place.

最初,我没有包含.metadata文件夹,导致一个队友的eclipse工作区完全破坏。项目不会显示在包资源管理器中,并且无法找到SDK。我在OSX下工作,他们在Windows上。那么我就包含了.metadata文件夹,这解决了未找到项目的问题,但提交是一场噩梦!总有数千个插入/删除并找到SDK,但它指向错误的位置。

Another issue is bin/ and gen/ files still show up as added/modified in Git. I know I'm missing something that is probably very obvious.

另一个问题是bin /和gen /文件仍然显示为在Git中添加/修改。我知道我错过了一些可能非常明显的东西。

My .gitignore

# Trying to get bin/gen to not show up in Windows
AllTests/bin
AllTests/gen
Fire-Alert/bin
Fire-Alert/gen

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/
target/
/bin
/gen

# Local configuration file (sdk path, etc)
local.properties

# Mac .DS_Store files
.DS_Store

File structure of my Eclipse workspace:

我的Eclipse工作区的文件结构:

├── .git
│   ├── branches
│   ├── hooks
│   ├── info
│   ├── logs
│   ├── objects
│   └── refs
├── .metadata
│   └── .plugins
├── AllTests
│   ├── .settings
│   ├── assets
│   ├── bin
│   ├── gen
│   ├── res
│   └── src
└── Fire-Alert
    ├── .metadata
    ├── .settings
    ├── assets
    ├── bin
    ├── gen
    ├── libs
    ├── res
    └── src

1 个解决方案

#1


2  

I don't have .metadata in my Android projects managed with Git and Eclipse. I don't think you need it.

我在使用Git和Eclipse管理的Android项目中没有.metadata。我认为你不需要它。

As per bin/ and gen/ files showing up as added/modified in Git... It would seem they were inadvertently added to version control. You can remove them with:

根据bin /和gen /文件显示在Git中添加/修改...看起来它们无意中被添加到版本控制中。你可以删除它们:

git rm --cached bin/ gen/
git commit -m 'cleaning up bin/ and gen/'

#1


2  

I don't have .metadata in my Android projects managed with Git and Eclipse. I don't think you need it.

我在使用Git和Eclipse管理的Android项目中没有.metadata。我认为你不需要它。

As per bin/ and gen/ files showing up as added/modified in Git... It would seem they were inadvertently added to version control. You can remove them with:

根据bin /和gen /文件显示在Git中添加/修改...看起来它们无意中被添加到版本控制中。你可以删除它们:

git rm --cached bin/ gen/
git commit -m 'cleaning up bin/ and gen/'