How do I keep library files out of my github repo yet still have them work if someone downloads my code? I get about 600 "changes" each time I make a small change to my code! Also if it changes anything I am using github desktop (not through cmd). Thanks in advance!
you need to use git ignore to ignore your build folders from updating with git. git ignore helps you to make a blacklist of items you dont want to commit everytime.
you can see how to make a git ignore file in below:
How to create .gitignore file
I guess you see changes to the workspace files modified by Android Studio / IntelliJ in the .idea folder. These files are automatically re-generated if you remove them and should be private to each user, i.e. not uploaded to source control with git.
Step by step fix
Close Android Studio
Remove the .idea folder in your project root (or backup elsewhere for now)
in the .gitignore file in the root of your project, add a line containing just .idea to ignore the folder and its content when you use git
Commit changes to git which should be the removal of the .idea folder & the .gitignore change
Open Android Studio, re-import you project
.idea folder is now regenerated and private to each git user
Run git status to verify
Related
I'm building a voice recording app and right now I'm backing up all of my code to GitHub and a memory stick. Whenever I make it build it saves it into the file directory that GitHub desktop it's backing up, but it won't detect some of my files. Such as: app.iml and app-debug.apk.
Has anyone else had this problem and if you have fixed it could you tell me how?
Those files shouldn't be committed or relied on since you will need to rebuild the project anyway when you do a fresh checkout. Your code might be different than your compiled code depending of how you added them. Check out this thread that talks about javascript Should compiled JavaScript files be committed to Git repo?
Sounds like Git ignoring files and directories specified in the .gitignore file in the root of your repository directory.
See lines from one of my repositories:
*.iml
..
..
/build
Your apk file is just the latest build of your code, so the source code saved to GitHub is the backup.
I was pushing my Android application project to my github repository. I saw two folder .gradle and gradle were not pushed but another folder called gradle/wrapper instead got pushed. I am not sure where this gradle/wrapper folder came from and if this is a normal thing that happens when pushing an Android app.
Edit: I closely inspected a bit more and the gradle folder that I was talking about is the gradle/wrapper folder. It is just that I didn't expand that folder initially. The .gradle folder is still not showing up in my Github repository though.
The .gradle folder should not be committed and should be included as part of the gitignore
https://www.gitignore.io/api/android,androidstudio
This is the directory used by the wrapper on your local machine to store the downloaded Gradle dependencies (as compared to installing Gradle separately yourself and configuring the IDE to use that)
build.gradle and settings.gradle should be the least amount of required files for any Gradle project, the wrapper is optional but recommended to standardize the version of Gradle used to build the project
if you don't see a file that you have pushed via git, please check your .gitignore file.
Gradle/wrapper folder is generated upon building.
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 have just uploaded my Android Project to my github repo and noticed that the volley folder is greyed out and can't be accessed.
So I took a closer look at my volley folder, inside my MyApplication folder and noticed a .gitignore file in it. Funny thing tho I didn't create the file. Is there a reason for this? Shouldn't I get rid of this file and upload my volley folder?
If someone downloads my Project and tries to run it, Android Studio will probably look for a volley folder that just isn't there?.. Am I missing something or ?
Thank you!
.gitignore is automatically included in volley project when you clone(or download) it from AOSP repository. Here is the content of .gitignore you originally face to:
bin
gen
.gradle
build
.settings
target
*.iml
.idea
local.properties
As you can see in the volley repository, there are no files or folders listed above. Therefore, you have not included none of the items in your project except src folder that you have compiled it in your project. So, don't worry. Nothing wrong would happen with it.
.gitignore is created automatically when you create a repo for a project. You should put inside it the path to files that you don't want to be uploaded to git, basically files that must be ignored like a database file.
I am working on an Android App and the APK file is located in the out folder. I am also using Mercurial as version control system and cloned the repo, the clone was successful but Mercurial created two APK files one inside the bin directory and another in the root directory of the project.
Why Mercurial created these extra two APK files and how to get rid of them?
You have these two files in repo, clone just show it to you
You didn't see only these files in original Working Copy, because (not discovered yet) local settings for original workspace now ignore these files (after they was commited to repo - see hg log FILENAME), but adding to ignore-list doesn't mean "automatically forget and remove from repo"
how to get rid of them?
In cloned repo-root create .hgignore, add global pattern for all and any (?) *.apk-file
hg forget both APK (or Forget from CMenu of THG)
commit changes
remove files from WorkingCopy