Can I just ignore into the gitignore the *.iml and misc.xml files inside and Android Studio project?
Where can I find an official gitignore for Android Studio?
Can I just ignore into the gitignore the *.iml and misc.xml files inside and Android Studio project?
Sure, why not? Android Studio is generally very good at importing Android Gradle projects and recreating the IDEA files, so anyone else working on the project shouldn't have a problem checking out the project and getting it to build.
There isn't an "official" .gitignore. What you choose to ignore is generally left up to you.
Most of Android Studio's configuration files (the .iml files and everything under /.idea) are basic project configuration that you don't need to worry about. If you are making changes such as manually ignoring folders in the IDE or disabling certain IDE code quality checks, you might want to check those respective files in so you have a consistent project setup across your team. For the vast majority of projects, you do not need those files at all.
Some teams also prefer ignoring all IDE-generated files and folders to keep the project IDE-agnostic. Whether you want to do that or you want to enforce a particular IDE on your team is another decision left up to you.
When you create a new Android Studio project, it will automatically generate a .gitignore for you. The default .gitignore as of October 2014 looks like this:
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
.idea/
app/app.iml
*.iml
Android Studio also currently generates a second .gitignore in your Android module's directory containing just /build.
Related
I'm using Android Studio 2.2.2, using the built in VCS tool. For some reason, Android Studio automatically adds a bunch of extra xml files and folders that I did not add nor edit.
More specifically, it's adding the following files when I don't want it to:
/_windows
IntelliLang.xml
debugger.xml
diff.xml
vcs.xml
web-browsers.xml
This makes making pull requests downright impossible as the master branch doesn't have these files, and none of my other group members seem to have this problem either.
Any help in removing / configuring Android Studio to stop this pesky bug?
--
edit: I am already using a gitignore file already. The weird thing is that my additional files are in the wrong folder too. Basically, my root folder, has a subfolder for my app. All the junk files are created in my root folder for some reason by Android Studio.
/root/
/_windows
IntelliLang.xml
debugger.xml
diff.xml
vcs.xml
web-browsers.xml
/my_android_app/
gitignore for my app
/files actually needed for my project
Turns out this feature is called "Settings Repository", and it's intended to save IDE settings automatically. I guess I might accidentally agree on some popup from IDEA which look like add files to the git repository, so this started working.
FIX: Open Preferences → Tools → Settings Repository → Delete. I also disabled Auto-Sync. Dunno where it's going to save if I delete everything, but I switch it off to be extra safe..
Use gitIgnore file.. i am currently using this .
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
.externalNativeBuild
/captures
check if the same works for you or not ..
if you want to know the details please check here
If the IDE you are using is adding files that it requires, but which you don't want to be included in your repository, then this is a good candidate for additions to your .gitingore file.
Are you currently using a .gitignore file?
More information can be found here:
https://git-scm.com/docs/gitignore
You basically add an entry for each file or folder you want to ignore, and as a result, git will no longer try to include these files in commits going forward.
There is a good resource here:
https://github.com/github/gitignore
For creating a default .gitignore file. You would pick the .gitignore template that closely matches the type of development that you are doing, and customize from there. For example, I always start with the default Visual Studio template.
Probably the best suggestion would be to use the template .gitignore file for Android Development which is located here:
https://github.com/github/gitignore/blob/master/Android.gitignore
NOTE: I would copy the contents of this linked file into this answer, however, these template .gitignore files are always changing, as new recommendations are being added. It is best to keep referring to the source file for the most up to date version.
It doesn't explicitly ignore the files that you have mentioned, but it could be that those files are created within a folder that is being ignored.
I am studying the file/directory structure of an Android Studio project.
I don't understand the purpose of two files in /app directory:
app.iml
proguard-rules.pro
May I have some explanation on these files? If I want to share my project with other programmers, then do I have to include these files or just whatever that goes under /src plus build.gradle is enough?
May I have some explanation on these files?
app.iml is an Android Studio-generated file, based on the contents of your build.gradle files, that is used internally by the IDE. Android Studio is based on IntelliJ IDEA; .iml files are IDEA's project metadata files. Android Studio does not consider them to be the system of record — the build.gradle files are — but presumably it was simpler to generate .iml files rather than rework IDEA to not need them.
proguard-rules.pro contains module-specific rules for configuring code obfuscation and shrinking. Presently, that is handled through a tool named ProGuard, which is why the file is named as it is.
If I want to share my project with other programmers, then do I have to include these files or just whatever that goes under /src plus build.gradle is enough?
app.iml is output; it isn't in build/ for technical reasons, I presume. You should not distribute this.
proguard-rules.pro is input. You should distribute this, even if it is largely empty at the moment.
app.iml is a file generated by Android Studio holding information about your project
It is the usual file format for IntelliJ.
proguard-rules.pro is used, if you enable proguard (minifyEnabled true) in your build.gradle file. It helps improving performance and keeping your app small.
To read more about proguard, read here:
http://developer.android.com/tools/help/proguard.html
From intelliJ documentation what I understand is you SHOULD share the iml files to for smooth collaboration with other developers who use android studio, I'm pasting the following text from their documentation, link here https://intellij-support.jetbrains.com/hc/en-us/articles/206827587-How-to-manage-projects-under-Version-Control-Systems
If you decide to share IDE project files with other developers, follow these guidelines:
Directory based project format (.idea directory)
This format is used by all the recent IDE versions by default. Here is what you need to share:
All the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings.
All the .iml module files that can be located in different module directories (applies to IntelliJ IDEA)
Be careful about sharing the following:
Android artifacts that produce a signed build (will contain keystore passwords)
In IDEA 13 and earlier dataSources.ids, datasources.xml can contain database passwords. IDEA 14 solves this problem.
You may consider not to share the following:
gradle.xml file
user dictionaries folder (to avoid conflicts if other developer has the same name)
XML files under .idea/libraries in case they are generated from Gradle project
Legacy project format (.ipr/.iml/.iws files)
Share the project .ipr file and all the .iml module files, don't share the .iws file as it stores user specific settings
Android studio will generate a .gitignore with the following values if you integrate git version control integration with the IDE
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
I try to import my Android Studio project on different machines and wondering which project files are realy needed. For example the .idea or .gradle directories. I won't to much trash in my svn repo. Can someone tell my more about required files for Android Studio projects?
You need to keep these files in your root project
app folder (tough ignore the build folder inside it recursively, it's a big waste of space)
gradle
.gitignore if you are using GIT
build.gradle
gradle.properties if you want to have the same configuration on all of your pc's. You need to cinfugure it first tough.
gradlew
gradlew.bat
settings.gradle
Anything else that is not on the list and was not created by you, can be ignored
Make sure you ignore these by file name wildcard. This is the garbage created by macs and windows machines.
.DS_Store
desktop.ini
Thumbs.db
*.iml (garbage created by Android studio)
I truely recomend you to use git in Android Studio, the integration is awesome and it`s so easy to use. It select the files u need for you and have really good tools for merge files.
With the change to the Gradle build system, I've noticed a bunch of *.xml files added to the .idea/libraries project directory. I'd assume this is how Android Studio/IntelliJ links libraries to the project.
Is it ok/recommended to add .idea/libraries to .gitignore? Since gradle handles all dependencies, I'd think either way these would be added/overwritten. Hoping for some confirmation.
Yes, why not.
I've been ignoring the whole .idea directory in my .gitignore, to avoid unnecessary changes get into the repo. Those IDE configurations can be regenerated from Gradle files.
In Eclipse, I had the custom of adding bin and gen directories to SVN ignore. But now, using Android Studio (based on IntelliJ IDEA), which files should I ignore?
I added the following items in my .gitignore, it should be the same for SVN:
gradle
.idea
*.iml
build
.DS_Store (for mac only)
See this IntelliJ IDEA KB article: "How to manage projects under Version Control Systems".
Add to Subversion:
all files under /.idea directory in the project root but ignore workspace.xml and tasks.xml,
all .iml module files.
I've used the following SVN ignore list sucessfully:
.gradle
local.properties
.idea/workspace.xml
.idea/libraries
.DS_Store
build
The ignore should be applied recursively.
Reference: Same question, for git