I was working on an Android project in Eclipse and I then decided to Git it. Being new, instead of creating a local repository in the parent of the project, I ended up creating it in C:\Users\Little\.git\LocalRepository.
Now, I am facing a lot of problems in my Android project; specifically with adding user libraries to my build path.
Based on this answer here:
Eclipse will not recognize project as library (ActionBarSherlock/ViewPagerIndicator)
I have imported all the user libraries to my workspace. However, my project itself is in a different folder and hence I am stuck. There is also a comment on the answer which says:
Thanks. In my case, I forgot that my project was imported from git and
was physically located in another folder than all other projects.
I believe I have to do the same. How do I get the project from local repo to my workspace?
May be below command help someone to get rid of same issue with command line :
Step 1 : To make sure that ur git does not contains any local changes do :
git status
make sure here there is files where u have changes something and is in red color
Step 2: To check when and how commited last do :
git log
Step 3 :
rm -rf .git
Make sure u just take backup.
Step 4 : do git clone to dir u need :
git clone ssh://firstname.lastname#xx.x.xx.xx:xxxxx/project_name
Related
With a friend we were a long time trying to work with Git and Android Studio, but we had a problem (we are very new to git and Android Studio, we started a couple of days ago on both issues).
What happens to us is that, for example, if I cloned the git repository and I try to make a merge, then the button to execute is grayed out and it doesn't let me compile or run it, also if I display the project structure as Android or Packages I see nothing, I can only see the files in Project, Project Files, Recent Changes, etc...
I will explain in detail everything we've done.
First, the repository looks like this (p and c are just the initials).
x (c)
/
x (master)
\
x (p)
Master has the first initial commit with .gitignore and README.md, nothing more, while we (me who created the branch p, and my friend who created the branc c) have just one commit each one with executable projects, although I'm not interested in joining what I've done with what my friend has done, I just want to start a new project of Android Studio with what my friend has made.
So I start Android Studio, "Check out project from Version Control -> GitHub", I put my key and choose the repository I want to clone, after that AS ask me if I want to create a new project and I click Yes.
I hit next until the new project is created and here I can see all the branches that we have created on GitHub.
After that I make a local branch to try to work with the project of my friend, with the option "Git branches -> New Branch" and calling it p, which moves me to this local branch automatically.
After that, I choose the Merge option of the remote branch origin/c, and I get a merge failure, that says "Some untracked working tree files would be overwritten by merge. Please move or remove them before you can merge.", I choose the option to view the files and it shows me these.
Since my project is completely new, and the project that my friend uploaded worked fine for him, I just deleted these files with the red bar that my mouse is pointing and after that a message appears that says there is no difference now.
Finally, after that, I go again to the merge option of the remote branch c, and a conflict message appears, which is on the .gitignore file, in my case I put to "Accept Theirs", and I see the message that the merge was correctly.
And now it is when I see that the button to execute is grayed and if I display the project structure as Android I see nothing, I can only see the files in Project, Project Files, etc...
I think it should be something super basic what I'm asking, but we (me and my friend) had never worked with git or android studio and now we are asked to make a project using them.
This is because you have added .idea folder in your git repository.Sample .gitignore file can be like this
build/
.gradle/
*.iml
.idea/
src/main/gen/*
*~
*.swp
local.properties
*.keystore
*.keystore.password
Also you need to delete this folder from git repo. You can use below command
git rm -rf .idea/
git commit -m "deleting .idea, updated .gitignore"
Then try to merge
Followed by #Akhil's answer, click "Make Project" icon to awake your Run button. Sometimes this button makes Android Studio recognize your project runnable again.
I was trying to upload my project to GitHub on Android-Studio.
Pushing to GitHub master... process never ends and Version Control Console gives this Error:
GitHub --credentials get: github: command not found
'C:\Users\SA'EED~1\AppData\Local\Temp\git-askpass-2722525787662236837.bat" "Username'
is not recognized as an internal or external command, operable program or batch file.
I only find an empty repository on my GitHub.
Assuming that you have the latest version of GitHub, check your git path.
Settings->version Control -> Path to git-executable
It should be something like -> C:\Program Files (x86)\Git\cmd\git.exe
Note this may vary upon where you have installed GitHub.
Try
Test
It should be a success. Try to push your code again.
If this does not work try solution 2
Solution 2:
Simply make a copy of your project(copy and paste) in some other location. Delete the .git physically from the new copy. Import the new copy into android studio again. Go to version control System(VCS)->Import into Version Control->Share project on github or bitbucket(whichever you have set up). Then enter master password and new repository name. Then your setup is complete and push your code.
You might find the answer you're looking for in this post: http://jrxie.blogspot.de/2014/02/github-credentials-get-github-command.html
tl;dr: you want to add your equivalent of the following folder to your PATH.
C:\Users\YOUR_USER_NAME\AppData\Local\Apps\2.0\LNKHAB6L.QR1\LP7D7JB2.E6Z\gith..tion_317444273a93ac29_0003.0000_c74cce3a838f9354
The folders inside Apps\2.0 are probably named differently, but you shouldn't have any problems finding the right ones.
This is not a question but is an answer to the issues I was stuck up while creating custom Android module for Titanium appcelerator.
I was able to run the ExampleProxy provided by the framework but was having problems creating my own Proxy class.
I was able to access the proxy. After lot of search I got the reference of following question -
http://developer.appcelerator.com/question/153993/how-to-create-a-proxy#answer-264746
Following response partially works-
"Thank you very much Benjamin Bahrenburg for the clarification. Also i
thank Mads for your quick response.
Exact answer i was looking for : Need to remove the files in the bin,
libs, and build folder. Then do a clean, in Eclipse. After all of that
it tends to build. Please make sure you are using Ti 3.1.0 ( not 3.1.1
which has an issue)."
In addition on windows 7 machine I had following observations-
The Module-generated folder in C:\Users\username\AppData\Local\Temp\ must be deleted.
In the module folder delete following contents - entire contents of bin and libs and delete everything in build except \build\generated\Application.mk
It cost my 1 day to solve this problem.
to successfully create and run a ViewProxy, you have to:
change its file/class name (from ExampleProxy) to ViewProxy
clean the dirty files, including: build/, dist/, and some "lib.so " files in libs/ folder.
execute ti clean in your "Titanium app" folder.
your ViewProxy is not the same as the module name. e.g. your module name is: "GaodeMapModule", your proxy name should not be: "GaodeMapProxy", it doesn't work.
I'm new to Git and Github and I'm trying to figure out how to push to the root directory on Github from Eclipse (Windows).
I have created a Github project called MyProject. MyProject is an Android project with the usual Android directory structure:
MyProject
src (+ res, assets, etc)
From Eclipse I push my Android project called MyGame to MyProject. MyProject now becomes a sub-directory to MyGame, so that the readme file in MyProject isn't visible unless the user first clicks on MyProject on Github to drill down one level in the directory hierarchy.
How can I push MyGame so that its contents (src folder, res folder, readme) become visible at the root level in the Github project.
Update: I tried using command line:
git remote add origin git#github.com:username/reponame.git
git push origin master
This has the same result, on Github the directory hierarchy is:
MyProject
MyGame
src
How can I make it
MyProject
src
?
I believe your problem may be that your git repo in Eclipse is in the parent folder of the project. What you need is for your git repo to be in the project folder.
Now, Eclipse seems to recommend that Git repos be set up in the parent folder of their projects. I am guessing that this is so that later related projects that may be needed can be easily added to the git repo. If you're not worried about that, and just want it to work as you described, see below.
Note that I'm running Ubuntu Linux, and so my Eclipse and desktop will probably look different from yours.
First we're going to find out if my guess as to the problem is correct:
Open the "Git Repository Exploring" perspective in Eclipse.
Look at the "Git Repositories" view. See if the path given for your repository is pointing to the folder containing your project. If it is, continue with the instructions below.
If your repo is in the folder above your project, then the problem shapes up like this: Git will recreate all the paths in your repo relative to the repository itself when you push it to GitHub. If it is in the folder above your project, then all the paths will include the folder containing your project. So, you'll need to move your repo into the folder containing your project. I'll describe the steps to achieve that below.
To begin, you'll want to make sure you don't have any uncommitted changes, or any stashed changes (if you don't know what stashed changes are, don't worry about them).
As a matter of caution, you may want to create a complete copy of your current code & repository at this point if it's at all important.
Open Windows Explorer and navigate to the folder containing your git repo, per the path given in the "Git Repositories" view.
At this point, you may want to close Eclipse, to avoid changes startling it (they shouldn't, but "you never can tell with bees!")
If you can see a .git folder in Windows Explorer, then go on to the next step. If not, you'll need to show hidden files. http://windows.microsoft.com/en-US/windows7/show-hidden-files gives instructions for Win7.
Now you should be able to see a .git folder. Copy this into your project folder.
Start Eclipse (if you closed it) and open the "Git Repositories" view again.
Click the button to add an existing local git repository. Choose the project folder.
Go back to the normal Eclipse Java perspective. Right-click your project and choose Team > Disconnect to temporarily stop heeding the old repository.
Right-click on the project again and choose Team > Share Project.... When prompted for a repository, check the box to use the one in the project/parent folder. In the view below, check the box of the one which is directly within the project folder (it will probably have one dot next to a folder.) Then click the Finish button.
Now you'll probably have a lot of catching up to do. Git will believe that you have deleted every file in your project and replaced it with a file with one less layer of directory path. You'll need to commit all those changes to get a clean repo.
Push the changes from step ten to GitHub. Check that it looks as you expect.
I hope this helps. Please comment if something's unclear or there's another issue. Please make sure to have a backup before you try this... I've not tested it entirely, and I don't want to cause any unneeded grief.
Like most android developers I use eclipse. When you set up a Android Library Project it is created in it's own directory.
Example:
/workspace/
/workspace/libproject1
/workspace/libproject2
/workspace/myapp
/workspace/mysecondapp
Now myapp will have a project.properties file that will have this:
android.library.reference.1=../libproject1
android.library.reference.2=../libproject2
And mysecondapp might have a project.properties file with this:
android.library.reference.1=../libproject2
How does this work with git? I check in libproject1 and libproject2 in there own repos. However if I use git submodules to connect the library project into myapp it wants to put them in a sub-directory. Then the project.properties files point to the wrong location. Is there a simple solution to this?
Git has nothing to do with the setups unless you use them as sub-modules. I have been having the library projects in separate repos, and each time someone has to clone them, they should be cloning them into a common workspace folder. And it should work.
android.library.reference.1=../libproject2
This means, that Eclipse would try to find your library project in the parent folder. If it finds it there, everything else if fine. If not, you will need to manually tell eclipse where to find it if you clone the library in another location.
Personally, I would not prefer using sub-modules. I haven't tried though.