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
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.
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
I'm working on an application and managing its repo on bitbucket.
During the development process, I created a new branch 'price-module' a few days ago and pushed its changes in the remote branch by the same name. Now, when I'm merging 'price-module' to 'master' branch, bitbucket is showing me an error that there are conflicts between some files. (specifically in bin/R.txt). How can I resolve these conflicts and merge the changes I did in 'price-module' to 'master' branch without losing my code?
PS: the project I'm working on is an Android project.
Update: what have I tried so far to solve the problem
I did some research on my own to try and solve the conflict between files. These are the steps I took to solve the conflict:
Switched to master branch, manually overridden the conflicted files by copying them from 'price-module' branch (they are mainly gen or bin), pushed them to master and then tried to merge 'price-module' into 'master' -- FAILED!
Added Android-specific rules in exclude file in my .git folder from this answer but the gen and bin folders kept showing up.
In an Android project, you should not be storing the bin folder in version control in the first place as it contains only generated files. Though R.txt isn't one of them, there's R.java in gen/your/package/name.
Assuming it's the generated bin folder, you should remove it from git, add it to .gitignore so it doesn't show up as non-versioned in git status, merge or re-apply the deletion to both branches, and just let the build tools generate bin files as needed.
For more things to not put in version control, see Typical .gitignore file for an Android app
I have a folder called 'assets' ( auto generated when creating a new android app using the wizard in netbeans ) but it does not show up in the git command line, nor does it get added to the repo even if I try to.
Any help?
Sounds like the directory is git-ignored. Check .gitignore at the root of your Git repo, and ~/.gitignore (your global ignore settings). Does assets show up in there? If so, do git add -f assets/ to force the add.
Git doesn't work with (empty) folders, only with files. If you need to commit a folder you need to check a file within, in order to force git to recreate that folder.
I suggest you to commit an empty file that begins with an underscore '.' like ".keep", this file will be ignored by android build process.
I hope that helps you
I am using EGit in eclipse to provide Git support for an Android project I am working on. The problem is that after committing my project to the local repository I realized that the "gen" folder was not getting committed. As a result of this when I try to open the project on another machine after getting the latest source from the Git repository I keep getting the following error:
ERROR: Unable to open class file D:\CodeRep\POCs\Java\Android\Sudoku\gen\org\blah\example\R.java: No such file or directory
Why can't I commit the "gen" folder to Git from Eclipse ? Everything gets committed just fine so I can push it to the remote repository.
You shouldn't be commiting the gen folder; it contains generated code and doesn't belong in source control. You should be recreating it on the machine you pull the source code on with either an Eclipse "Project -> Clean" or a command line "ant clean" if you're using the build scripts.
This is a file of generated code, you would normally only be commit sources to git.
You probably need to clean your project when you check it out, perhaps you've got some other object files mistakenly included in the commit so it looks like it's already been built.
It shouldn't be necessary to commit the "gen" directory to git as everything in it should be automatically generated based upon content elsewhere in your source. In fact, the "gen" directory may have been added to your .gitignore by the Android SDK.