GitHub connecting to an existing project with Android Studio - android

I want to create a repository which my coworker will push his project files into it. When we tried this he did not know how to do it without firstly pulling the existing files which I was created before. But we don't want them. How can he replace his project files over my existing repository files?

It is possible and you can do it like this:
First configure AS so that you share the same repository
Then:
and finally
In order to replace your files you are working on simply synchronize and commit files!

You (or your coworker) will have to manually remove the files (then commit and push the removals) you don't want. You can do the removal before your coworker clones the repository.

Related

Android Studio changing xml code style issue

When I work with my Android Studio it always changes my XML code style settings. The only way to return it is to go to Preferences->Editor->Code style -> XML and select Scheme as Default.
But I do it a lot of times.
This question on StackOverflow doesn't match my problem.
Is anyone know how to fix it? Thanks in advance.
I think you did not provide enough information to understand what is the problem here. However, I think, your workspace.xml file is resetting each time you are updating your code from git or some other version controlling system. If you are using a mac, the code styling or other configuration of the IDE is stored in here and each time you load the program, it loads the IDE configuration from the file.
Now there can be several cases here.
You are not committing the changes in your workspace.xml file while you are committing and pushing your changes to your remote git repository.
You might have added the workspace.xml file in git/remote repository before and then have added the file in your .gitignore file later. Hence, the newly modified workspace.xml is not being tracked anymore and the changes are not submitted in the remote repository. And then each time you are pulling the code from the remote repository, you are getting the older version of your workspace.
If this is a problem with a git, I would recommend removing the file from the remote git repository as described here in this answer.

How to add android studio project in same repo on github

When I uploaded a project on github, it automatically created a new repo with the project name. Now, I want to add another project on my repo. The thing is I want all of my android projects on the same repo. How do I do this?
The new project I want to add is throwing me error like "remote with selected name already exists".
The github error when trying to push.
EDIT:
Now when I created a folder in my system and tried uploaded it using this link, some of my projects aren't opening.
What's this? Any help is widely appreciated!!!
Right way todo this. follow these sample steps or you can add it manually
Check out git repo and open it in Android Studio.
Choose Import Module from File > New
Copy your project folder path and past into source directory: click finish that you want to add in existing repo. This will allow you to switch between projects right from Android Studio.
Commit and push your code.
Note: Make sure you don't have app with same name. by default it says app
You cannot upload all projects on the same repo. You have to do it manually.
or you can make a folder and then place all your projects inside it.
You can't create two repositories with the same name. If you want to put all your projects in same repository, you could either create separate directories under same git or , you could create separate branches.

Migrating SVN to Android Studio

I'm migrating my Android project from Eclipse to Android Studio. I use Subversion and am wondering how I can migrate my SVN to the new file structure used in Android Studio without losing my history.
Thanks for any help!
Posting this because it might help someone else.
I ran into the same problem as well. #user714965 was inspiring but didn't solve my problem because I couldn't figure out how to get SVN recognize that I moved a file from the original folder to the new structure in my working copy.
For the following, you will need TortoiseSVN or a similar SVN GUI client to do this.
Here is what I did:
Commit the Eclipse project last changes into the SVN repo.
Open Android Studio and use that to import the Eclipse project working copy.
Android Studio will nicely convert the Eclipse project into a Android Studio/Gradle project. Let's call this project "PrjGradle".
Open the converted Gradle project folder window and keep it one side of your screen
Go into your SVN repo where you have your project (using TortoiseSVN).
Backup your current trunk into a branch or a tag and call it "final_eclipse" or whatever.
Now, mirror the folder structure of the newly converted Gradle project on your local machine directly on the TortoiseSVN Repo Browser window. Meaning, look at how the directory is structured in "PrkGradle" and create/delete/rename folders directly on the trunk repository. This will be painstakingly tedious but you have to bear with it if you want to preserve your SVN history.
When you move files around (not copy) directly on the repo, the history of the files remain intact.
Once you complete, check out the restructured directory into your local machine. Let's call this "NewPrj".
Use a suitable Folder compare program (such as Beyond Compare) to synchronize missing items (such as build.gradle, .iml files, etc.)
Rename your converted project to "PrjGradle_old", and rename the newly checked out project (NewPrj) to "PrjGradle".
Open "PrjGradle" in Android Studio. That's it!
Hope it works out.
I don't know the differences of both file structures. But it would try it this way:
Check out your project (maybe better use a client like TortoiseSVN)
Build the new file structure (new folders)
Commit
Move the files from the old structure to the new
Commit (check the commit dialog if there are move actions only!)
Delete old folders which you don't need anymore
Commit
SVN will recognize these move operations. You will see if it works by the operations in the commit dialog. If there are "delete"/"new" actions something went wrong there should only be "move" actions.

Android Studio and SVN - Not every File/Folder will commit

I use Android Studio IDE with Subversion and I commit the Android Project.
But not all files will commit, because if I do a checkout in a other directory, many folders and files are missing like "res", "activity.xml"
Any suggestions?
Thank you for the answer.
I solved the problem by this way:
Right click on a folder/file->Subversion->Add
After that, svn detects the change.
I guess that those items were added to svn:ignore versioned property since they don't need to be version-controlled. See "How to manage projects under Version Control Systems".

How to use git with android libraries?

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.

Categories

Resources