简体   繁体   中英

how to add android project to git

I have an android project developed in Eclipse with the ADT plugin. I want to add it to git and finally host it on github. But i am confused as to which all files will need to be added to git to make it easy for other developers to work on the project.

Obviously, the following needs to be added :

  1. src folder
  2. res folder
  3. AndroidManifest.xml
  4. proguard-project.txt
  5. project.properties

But i see other files/directories in my project folder, which i am not sure about :

.classpath
.project
bin/
gen/
proguard/

Can i skip these and expect the other developers to successfully recreate the project to work-on/build it?

This is the .gitignore file that I use with android projects. You can use the same. .classpath and .project are eclipse project files that other developers don't need. bin/ and gen/ are generated files and will be generated automatically when someone builds the project so they can be left out. The proguard/ directory is also generated every time you build in release mode and can be left out.

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

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

# Eclipse project files
.classpath
.project
.settings

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
*.ipr
*.iws
.idea/

Check this .gitignore file from Google I/O App . This is what I use for my projects

However this is mainly intented to the Gradle based Android projects (for IDEs Android Studio, IntelliJ IDEA and Eclipse) it'll work very well with traditional Ant based projects too.

Set up your local directory

    mkdir /path/to/your/project
    cd /path/to/your/project
    git init
    git remote add origin git@server.org:urproject/monikacodes.git

Create your first file, commit, and push

echo "ur_name" >> contributors.txt
git add contributors.txt
git commit -m 'Initial commit with contributors'
git push -u origin master

then u can commit remaining source code :

git status
git add --all
git commit -m "commit message"
git push origin HEAD:refs/for/master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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