Create Android project in my local git repository - android

I have a git repository cloned from github. Then I go to my local copy of that repository. There are sub-module projects in the repository.
Now, I would like to create a new Android project. So, in Eclipse I did:
File -> New Android Application Project -> (fill project name, etc) Next -> I browse to my git repository, but Eclipse doesn't allow me to create project there, it complains "Folder is not empty".
But I need my new Android project to be created in the repository. How to get rid of this problem with eclipse?

Make your android project in an empty folder and then copy and paste the contents into the root of the directory where you have a git project.
You'll need to make sure you add everything with git add -A

Related

New Git repository thinks it already has files added

Story:
I saw that my bitbucket remote repository has not all files and I could not add them to git.
I deleted the .git folder and made a new Git-repository to push to a new bitbucket repository.
Problem:
The new Git-repository thinks it has the old files already added. I cannot add them or commit them (No changes detected). The other "new added" files are red and I can add them (green). I dont know why. (Under Project Settings -> VCS there are no other repositorys than my new one).
Solution:
I found another .git folder, somewhere hidden in my project directory. Git thought this is a submodule. --> Always remove ALL git folders from your project.

Remove module as library from git using android studio

I was using a project as module dependency in Android Studio. I no longer now need it. So I removed the dependency from build.gradle file and then committed and pushed it. When i take a fresh check out using git in Android Studio, i am able to see that module, even though that is not being used by my project. If i check on the git site, the folder is still there. I think i need to delete it from the cache of the git which maintain the history of this. But I do not know the commands to run in the Android studio terminal to completely remove it from git respository.
Project Structure
Project
|
-app
-build.gradle(removed dependency of module 1)
-Module1
-Module2
-module3
-settings.gradle(removed module1)
Want to remove module1 from the git. Please let me know the commands.

How to delete a repository and add a new one in Android studio?

I was working with VCS enabled in Android Studio and pushed my code to a repository that I had created in BitBucket. However, now the team I'm working with has created a new repository also on BitBucket and I have to switch my entire project there. So how do I stop VCS in my current project, and push code to a new repoositroy with a new link from scratch?
Also, in the first repository that I was working with only the "java" folder was pushed and not the rest. Now in the new repository I want to be able to commit and push changes made in all other files as well like "res" etc.
U can remove connection from git repository.
step 1 :Open git bash.
step 2 : navigate to the master folder. '
step 3 : $ git remote rm origin
The git remote will now be removed from the repository.
Now u can add new connection by using VCS->Git->+add.
[Remove and add git]
or you can add/edit remote url
VCS -> Git -> Remotes...

Import an eclipse android project with version control system into Android Studio

I am trying to import an eclipse project with version control system into Android Studio.
Support for direct eclipse project import was added in Android-Studio version "0.5.5" where we don't need to export project first from eclipse to import it into Android-Studio.
I have an eclipse Android Project which I am trying to import into Android Studio.
Import is successful but imported project no more has version control.
Edit:- More detail
Suppose I have following Directory Structure
Project ----
|---------- .git/
|----------- MyApp
|------------MyApp_imported
During project import, I point Android Studio to Project Directory "MyApp", It copies all files in my project "MyApp" to new directory "MyApp_Imported". But imported project doesn't have version control enabled.
Now I am not sure how to proceed further.
How should I tell Android Studio to use old repository for imported project.
A step by step guide to do this will be very helpful .
Here is text from Android Tools Project Site
Project
- Importing modules should now work properly. You can import existing Eclipse
ADT projects as well as Gradle modules into an existing Gradle project;
it will copy in the sources as is done for full project import, as well as
handle dependencies transitively. Import modules either from the project structure dialog or the File | Import Module action.
- New project structure dialog implementation: Should be faster, includes
Gradle sync notification, should only perform a Gradle sync at the end
when necessary, and won't list invalid IntelliJ module warnings as before.
This is actively being worked on and the individual editors
(for flavors, build types, signing configurations etc) will be improved
in upcoming builds.
Here is the step by step solution to do it.
Open Android Studio -> Import Project-> Select your project directory. (In above case "MyApp")
Remember Select the directory which contains Manifest file otherwise new "direct import wizard" doesn't
get triggered and android studio uses old import wizard.
Android Studio will create a copy of your project "MyApp_imported" with new directory structure.
Copy your existing ".git" directory inside "MyApp_imported"
Android Studio -> VCS -> Enable version control
This will make Android Studio use your existing repository for imported project. Though imported project has
different directory structure but git handles them pretty well.
You might want to also call git add . and git add -u in the root folder of the imported project to make sure all new files are added and existing file moves are detected by git.
Android Studio -> Changes
Review all files and commit. Git will automatically handle new directory structure and file history etc will not be lost.
Now you can share it on github/Bitbucket by
VCS-> Share it on GitHUb
Note:- For bitbucket you will have to install "Bitbucket plugin" for Android Studio.
Couple of months ago I got my job as android developer.The first problem i had faced were my collegues who using Eclipse.I was allowed to use Android studio if I will not make any changes to existing project structure.After 3-4 attemps I finally found a decision.Here is steps to open Eclipse git project without migrating to Gradle and without changing project structure.
Clone git repository of project
Add /gen and /.idea to .gitignore
Open any of already created Android Studio projects.
File -> Open -> Choose path root project folder(with src and res inside)
Doble-click project to open project structure
Select root project folder -> F4
Project -> Project SDK -> Android API XX Platform && Project language level -> Override in interfaces
Modules -> Sources tab. Mark src as Sources && res as Resources.
Modules -> Paths tab. Use module compile output path.Create folders output and output_test inside gen folder (create gen if folder not exist yet).Output paths should look like C:\Users\User\project_rep\project\gen\output
Modules -> Dependencies tab. Click "+" -> Jars or directories.Select all .jar libraries which are using by your project.(Android Studio can pretend like its added only one jar but thats not true)
Facets -> "+" -> Android
Facets -> Structure tab -> Reset to defaults.
Close Project Structure window.
Run -> Edit configurations -> Android Application -> Module -> Select your module.Target device -> Show chooser dialog.
Edit configurations -> Before launch -> remove Gragle aware make, add Make.
Finally, after all of those steps you are able to hit Run button.Enjoy!
The import process does not make this easy. But here's something to try:
Let Android Studio do what it wants to do. It creates a file in the root of the new copy of the project which shows what was moved where.
Make a fresh (scratch) copy of the original git repository. Use "git mv" commands to duplicate the directory structure changes which Android Studio made. Commit the changes.
Copy the resulting .git directory into the project made by Android Studio. Use "git status" there to see how the result of the import process differs from what you did in your scratch copy of the project. At this point you might just choose to commit the remaining differences right there.

Installing facebook sdk for android, installation procedure, gen folder missing

I am trying to use the facebook sdk for android, available here. I have two questions:
Problem 1: From the instructions...
Step 1.Pull the repository from GitHub:
git clone git://github.com/facebook/facebook-android-sdk.git
Does this simply mean download the files?
Problem 2:
I downloaded the files and opened the samples as a New Android Project (from existing source). The project files do not have anything in the gen folder.
I have tried
Choosing Project >Build
Choosing Project > Clean
editing Java file (Example.java) and resaving it
checking the Java commpliance level is 1.6 (Project > Properties > Java Compiler)
deleting the gen folder and rebuilding (Project > Build)
putting my Facebook App ID in the example.java file
Any help would be appreciated.
cloning the repository means using the Git version control system to a local copy of the repository which you can update and get the latest code changes at any time. If you are not concerned with having the latest changes in the sdk then you can simply download the zip or tar file (which I think you did)
The contents of the gen folder are automatically generated when you build an android project. If there is an error in the build process then the gen folder maybe empty. Please check the console (Menu -> Window -> Show view -> Console" in Eclispe and see if there are any build errors.

Categories

Resources