Unable to add android project to GitHub account in Android Studio - android

I tried to add my Android project to my Github account using Android Studio's
VCS -> Import into Version control -> Share project on github
However, I am getting this https://github.com/vkrpro/Musica.
I tried the solution recommended, but I am still not able to create my repositories. After that I deleted my empty repositories, but I am still seeing the commit command on Android Studio. How can I get around this?

Follow these steps:
VCS -> select "Enable Version Control"
Then in the left panel click on Android and select Project
Then right click on the name of the project then from menu select Git -> sekect "Add".
After all the files are added go to VcS -> Select "Commit".
Add a message then select commit and push at bottom of the dialog which has appeared.
A dialog will open where you should define remote and add the link of you directory created in git hub.
Then select "Push" at bottom of the dialog.

you can only import a project from VCS if you have already created it. to do that you first need to create a repository on Github
commit your work then push to the remote Github repository. you can then link your local and remote work using VCS.

Related

How to create an Android Studio project from a subdirectory in a github repo

I need to create an android studio project from this directory on github. I tried VCS -> Checkout from Version Control in Android Studio, but there is no url for this directory in the repo, so I'm not sure hot to clone just this subdirectory.
I also tried downloading the whole repo, doing File -> New -> Import Project in Android Studio, and selecting the messaging subdirectory as the folder to import. This showed a build progress bar, but after it finished, there was no imported project.
How do I do this?
I am not sure if its the correct way, but i resolved it with the following steps on Android Studio 4.1.1 :
Run Android Studio until the Welcome to Android Studio screen shows up.
Select Get from Version Control.
Paste the URL.
Press Clone button.
This will import the complete repository , but you won't be able to run the app yet (exactly as mentioned in your question) .
Now close and re open Android Studio
On welcome screen, select import Project (Gradle, Eclipse ADT, etc.)
Navigate to the folder where the project was downloaded and select the required Sub-folder
Press OK and let the Studio build your project.
I get it now. Go back to this. Then hit Download Zip and unzip it. In Android Studio go to File -> Open -> then to the quickstart-android-master and then down to messaging. Do NOT open quickstart-android-master go down to messaging and open that.
EDIT
Be aware you will have to follow these instructions to get the project to build and run.
Add google-services.json in android studio

How to import a Project from bitbucket repository to Android Studio?

I have repository in BitBucket while cloning project
If I select "Ïmport Gradle project"
On clicking "OK" , it start building project , then gives error
If I select "Configure" to configure android project it build project but it didn't run .
How to resolve this error ?
launch bitbucket.org, login to your account, select the repo which you want to import. select HTTPS and copy the link.
launch Android studio. select 'Check out the project from Version Control'
paste the link, fill in other information as asked and confirm.
this will clone your bitbucket repo in the android studio.
BitBucket is a GitHUB based site.
You simply need to clone the repo you need to your local pc.
Open that repo (project) in Android Studio, and Android Studio will give you the option to enable “VCS” (This is Version Control System).
It will automatically sync with your repo, and list all your branches and so on.
You don't need to do an import, if it is already an Android Studio project.
For your error, try these as reference:
Volley might be giving you an issue (File Structure stuff)
If you have modules as part of the repo
Refer to this answer
You need to make sure that each submodule in your project has its own build.gradle file. The name 'default' happens because your outer build.gradle is trying to build a project that doesn't know how to build itself, thus it is given the name 'default.' Try doing that and see what happens.
The owner of the project should give you the access to one.
Then in android studio go to VSC tab in most top bar and select
VCS --> git --> clone..
Then in dialog popup in the first editbox past the 'httpsed' url and press "Clone"
Then wait untill project is clonned

How to get this project up and running on an Android?

This project at a hackathon was just simply ingenious. And as a curious noob, I want to check it out. They don't have it on PlayStore, nor did they have an APK, but I want to see how it works. So how would I run this on Android?
It's also important to note that this is not a typical Android project. This doesn't work with just importing it to android studio. Trust me, I've tried it like that.
Navigate to terminal/cmd git it by the URL:
git clone https://github.com/getSizeOf/sizeOf-Droid.git
Open Android Studio click on import project, click import project
Click on build.gradle on the project level
Project opened, get coding!!!
Try opening the project with 'project' being the root folder. I just opened it in Android Studio 1.2.2 (latest) and it works fine.
Sometimes, when you open an existing project, you have to expand to show the project structure by clicking on "1. Project" and then select "Project" from the drop-down menu (person preference).
To run on a device, select "Run" from the toolbar then click 'Run app' from the drop down menu.

How do you synchronise projects to GitHub with Android Studio?

I am trying to synchronise a project that I have on in my Android Studio folder to GitHub, but I am not fully sure what to do other than adding my credentials in the options menu. Could someone give me a quick guide, please?
Open the project you want to push in Android Studio.
Click VCS -> Enable version Control Integration -> Git
There doesn't seem to be a way to add a remote through the GUI. So open Git Bash in the root of the project and do git remote add <remote_name> <remote_url>
Now when you do VCS -> Commit changes -> Commit & Push you should see your remote and everything should work through the GUI.
If you are getting the error: fatal: remote <remote_name> already exists that means you already added it. To see your remotes do git remote -v and git remote rm <remote_name> to remove.
See these pages for details:
http://www.jetbrains.com/idea/webhelp/using-git-integration.html
http://gitref.org/remotes/
Following method is a generic way of pushing an Android Studio project to a GIT based repository solely using GUI.This has been tested with a GIT repository hosted in Visual Studio Online and should virtually work with GitHub or any other GIT based version control provider.
Note: If you are using GitHub 'Share on GitHub' is the easiest option as stated in other answers.
Enable the GIT Integration plugin
File (main menu) >> Settings >> Search for GitHub Integration
Enable Version Control Integration for The Project
VCS (main menu) >> Enable Version Control Integration >> Select GIT
Add project file to Local repository
Right Click on project >> GIT >> Add
Commit Added Files
Open the Version Control windows (Next to terminal window) >> Click commit
button
In the prompt window select "commit and push"
Defining Remote
After analyzing code android studio will prompt to review or commit code
when committed will be prompt to define the remote repository.There you can
add the url to GIT repository.
Then enter the credentials for the repository and click 'Ok'.(Visual Studio
online Users need to enable "alternate authentication credentials" as
mentioned here to login to repository)
On Android Studio 1.0.2 you only need to go
VCS-> Import into Version control -> Share Project on GitHub.
Pop up will appear asking for the repo name.
In the version of Android Studio I have (0.3.2), it was as easy as using the menu.
VCS Menu > Git > Share on GitHub.
It will then ask you for your credentials, and then a name for your new repo, and that's it!
This isn't specific to Android Studio, but a generic behaviour with Intellij's IDEA.
Go to: Preferences > Version Control > GitHub
Also note that you don't need the github integration: the standard git functions should be enough (VCS > Git, Tool Windows > Changes)
Android Studio 3.0
I love how easy this is in Android Studio.
1. Enter your GitHub login info
In Android Studio go to File > Settings > Version Control > GitHub. Then enter your GitHub username and password. (You only have to do this step once. For future projects you can skip it.)
2. Share your project
With your Android Studio project open, go to VCS > Import into Version Control > Share Project on GitHub.
Then click Share and OK.
That's all!
For Android Studio 0.8.9: VCS --> Import into version contraol --> Share project on Github. It doesn't give you option to share in a specific repository or at least I couldn't find (my limitation!).
You can add your github info here: File --> Settings --> Version COntraol --> Github.
Now you can do it like so (you do not need to go to github or open new directory from git):
First time I have added a video link for solving your problem but I learned it was a bad idea. This time I'll explain it briefly.
Android studio is compatible with github but you need adjust something:
Setup Android Studio
Setup the Github plugins in the Android Studio settings
Android Studio settings >> Plugins page
Download the git version control system from this link and setup
https://git-scm.com/
After the installation, open Android Studio settings page and select the git.exe
settings >> version control >> git
Usually the path to git.exe is program files >> git >> bin >> git.exe
Go to Settings >> Version control >> Github you will see login and password for your Github account. Apply the settings.
For updating the project, go in Android Studio top line click
VCS >> enable version control integration >> git
One more time
VCS >> import into version control >> share project on Github
and enter your master password.
Now you can use VCS update buttons for updating your project to Github
For existing project end existing repository with files:
git init
git remote add origin <.git>
git checkout -b master
git branch --set-upstream-to=origin/master master
git pull --allow-unrelated-histories
In Android Studio 0.8.2 , you have the same option (ie Share on GitHub). If you want to find it, you can use ctrl+shift+a and enter github in the input text.
Github with android studio
/*For New - Run these command in terminal*/
echo "# Your Repository" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/username/repository.git
git push -u origin master
/*For Exist - Run these command in terminal*/
git remote add origin https://github.com/username/repository.git
git push -u origin master
//git push -f origin master
//git push origin master --force
/*For Update - Run these command in terminal*/
git add .
git commit -m "your message"
git push
This is how I got mine working using Android Studio UI:
Delete .git folder from your project folder.
Delete .git folder from all your project subfolders.
Open project in Android Studio.
Settings, Version Control, remove all the roots
Go to VCS, Import into VC, Create git repository
Select the directory
Make sure your folder is the only root in Settings, Version Control
Go to VCS, Import into VC, Share project on Github
Mark as private if wanted.
Select all the files for initial commit, including app folder
Add files, select all in your project folder and app folder.
VCS > Commit -> to commit the files.
VCS > Git > Push -> to push the files.

Connecting to GitLab repositories on Android Studio

I'm trying to connect to a GitLab repository using the I/O preview of Android Studio. Does anyone know how to do this/if it is possible yet?
How to add an Android Studio project to GitLab
This answer shows how to do it using the Android Studio GUI.
1. Create a new project on GitLab
Chose the + button on the menu bar. Add a project name and then click "Create project".
This will give you a new project address. Choose the https version.
It will look something like this:
https://gitlab.com/MyUserName/my-project.git
2. Create a Git repository in Android Studio
In the Android Studio menu go to VCS > Import into Version Control > Create Git Repository...
Select the root directory of your project. (It will be automatically selected if you already have it highlighted in the Project view. Otherwise you will have to browse up to find it.)
3. Add remote
Go to VCS > Git > Remotes.... Then paste in the https address you got from GitLab in step one.
You may need to log in with your GitLab username and password.
4. Add, commit, and push your files
Make sure you have the top level of the project selected. If you are in the Android view you can switch it to the Project view.
Add: Go to VCS > Git > Add.
Commit: After adding, do VCS > Git > Commit Directory. (You will need to write a commit message, something like initial commit.)
Push: Finally, go to VCS > Git > Push.
Finished!
You should be able to view your files in GitLab now.
See also
There is a plugin that would probably streamline the process. Check it out here.
To clone a repo
Open a new project in Android Studio.
Click VCS -> Checkout from version control -> Git
then enter the URL of the repo and your local direcory
To commit
Open the project you want to push in Android Studio.
Click VCS -> Enable version Control -> Git
There does't seem to be a way to add a remote through the GUI. So open Git Bash in the root of the project add do git remote add <remote_name> <remote_url>.
Now when you do VCS -> Commit changes -> Commit & Push you should see your remote and everything should work through the GUI.
See these pages for details:
http://www.jetbrains.com/idea/webhelp/using-git-integration.html
http://youtrack.jetbrains.com/issue/IDEA-87099
Use CodeStream plugin, easy configuration

Categories

Resources