What .gitignore Android Studio project should be?

This translation from: the What Should BE AN in My .gitignore for Android Studio Project?

My Files Should BE in the What .gitignorefor AN Android Studio Project? Android Studio project .gitignorefile which should contain the file?

Examples that 'several''ve Seen the I All the include .imlBut IntelliJ docs say that .imlthe MUST BE included in your Source Control. I've seen a few contain .imlexamples, but IntelliJ document says .imlmust be included in the source code control.


#1st Floor

Reference: -gitignore https://stackoom.com/question/18E1I/Android-Studio what projects should be


#2nd Floor

Basically any file that is automatically regenerated. Basically, any automatically re-generated files.

A good test is to clone your repo and see if Android Studio is able to interpret and run your project immediately (generating what is missing). A good test is to clone your warehouse to see if Android Studio can immediately interpret and run your project (to generate the missing content).
Not IF, the What IS the Find Missing, and the make the Sure IT IS not ignored, But added to at The repo. If not, look for the missing content, and make sure not to ignore it, but add it to the repository.

Being of Said That, you CAN ON the Take Example existing .gitignoreFiles, like at The Android One . Having said that, you can in the existing .gitignoreexample on the file, such as Android One .

# 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

# Proguard folder generated by Eclipse
proguard/

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

#3rd floor

I use this .gitignore. I use this .gitignore. AT IT I found the I: http://th4t.net/android-studio-gitignore.html I found it in the following locations: HTTP : //th4t.net/android-studio-gitignore.html

*.iml
*.iws
*.ipr
.idea/
.gradle/
local.properties

*/build/

*~
*.swp

#4th floor

In the case of Android Studio, the only files that are required to be saved in version control are the files required to build the application from the command line using gradle. For Android Studio, the only file needs to be saved in version control is to use gradle files needed to build the application from the command line. So you can ignore: Therefore, you can ignore:

  • * .iml * .iml
  • .idea . idea
  • build build

However, if you save any IDE settings , such as custom code style settings, they get saved in the .idea folder. However, if you save any IDE settings (such as custom code style settings), they will be saved in the folder .idea . If you want those changes in version control , then you'd save the IDEA files as well (* .iml and .idea). If you want to make these changes in version control, you also need to save the IDEA file (* .iml and. idea).


#5th Floor

Depends on how your project format is maintained : it depends on maintenance mode project format:

You have two options: You have two options:

  1. Format-based Directory (by You by Will have have A .ideaFolder Which the contains specific at The Project Files) based on the format of the catalog (you will have a .ideafolder that contains project-specific files)
  2. The format-based File (Configuration Files are .iwsand .ipr) based file format (file configuration .iwsand .ipr)

Ref: http://www.jetbrains.com/idea/webhelp/project.html Reference: HTTP : //www.jetbrains.com/idea/webhelp/project.html

Files committed to version control depends on the above: committed to the file version control depends above:

  1. .Idea Folder Version Control to the include, the exclude workspace.xmland tasks.xml include .idea folder to version control, exclusion workspace.xmlandtasks.xml
  2. Control Version .iprFile and All at The .imlModule Files, the exclude at The .iwsFile specific AS IT Stores the User Settings. Versioned .iprfiles and all .imlthe module file does not include the .iwsfile because it stores user-specific settings.

Ref: https://intellij-support.jetbrains.com/entries/23393067 Reference: HTTPS : //intellij-support.jetbrains.com/entries/23393067


#6th floor

My advise would be also to not ignore the .idea folder. My advice is not to ignore .idea folder.

I've imported a Git-based Eclipse project to Android Studio and that went fine. I have imported Android Studio based on the Eclipse Git project, everything is normal. Later, I wanted to import this project with Git (like the first time) to another machine with Android Studio, but that did not worked. Then I want to use this project with Git introduced together (as with the first) to have Android Studio on another computer, but to no avail. DID the Load at The Studio All Android Files But WAS not of Able to 'See' at The Project AS A Project. Android Studio really load all the files, but they can not project "as" project. I only could open Git-files. I can only open the Git file.

While importing the project for the first time (from Eclipse to Android Studio) my old .gitignore was overwritten and the new one looked like this: first import project (from Eclipse to Android Studio) when my old .gitignore covered, new the .gitignore follows:

  • .idea/.name .idea / .name
  • .idea/compiler.xml .idea / compiler.xml
  • .idea/copyright/profiles_settings.xml .idea / copyright / profiles_settings.xml
  • .idea/encodings.xml .idea / encodings.xml
  • .idea/libraries/libs.xml .idea / libraries / libs.xml
  • .idea/misc.xml .idea / misc.xml
  • .idea/modules.xml .idea / modules.xml
  • .idea/scopes/scope_settings.xml .idea / scopes / scope_settings.xml
  • .idea / vcs.xml .idea / vcs.xml
  • .idea/workspace.xml .idea / workspace.xml

So, I tried to use an empty gitignore and now it worked. So I try to use empty gitignore, now it it. The other Android Studio could load the files and the Project. Another Android Studio can load files and projects. Files are not some GUESS the I Important (profiles_settings.xml)for Git and Importing But the I AM the Just Happy IT worked. I guess it does not matter for some files and import Git (profiles_settings.xml), but I'm glad it works.

Original articles published 0 · won praise 136 · views 830 000 +

Guess you like

Origin blog.csdn.net/xfxf996/article/details/105262975