Android Studio 使用github

简介: 转:    How to use GitHub with Android Studio   This article will explain how to use GitHub with Android Studio.

转:

  

How to use GitHub with Android Studio

 

This article will explain how to use GitHub with Android Studio.

Firstly, let’s login to github.com and create a new repository. From the top right corner of the screen, click the +sign and select New repository.

GitHub "New repository" option

Now complete the form to create a new repository called testproject. Leave the Initialize this repository with a README unticked.

GitHub create new repository form

Next, open Android Studio and create a new project. Call your new application TestProject. Click Next to continue.

Android Studio new project window

Leave the next page as default and click Next.

Android Studio "Select the form factors your app will run on" screen

On the Add an activity to Mobile screen select Blank Activity and click Next.

Android Studio "Add an activity to Mobile" screen

In the next screen, leave the default activity name of MyActivity and click Finish.

Android Studio "New file options" screen

Your new project will open in Android Studio. On the top menu, select VCS > Import into Version Control >Create Git Repository.

Android Studio "Create Git Repository" option.

On the next screen, leave it all as default and click OK.

Android Studio "Select directory for git init" screen

Now use Internet Explorer and navigate to the root of your projects folder. Right click and select Git Bash (If you do not see this option, then first install Git for Windows).

When the Git bash screen appears, type:

1
git remote add origin https: //github .com/[username]/[project_name].git

An example of a Git repository URL is: https://github.com/markwint/testproject.git

Entering command into Git Bash

Then press enter. The GitHub remote will be added to your Git repository.

Next, jump back into Android Studio, right click your projects root directory and select Git > Add. This will add all your project files to your Git repository.

Android Studio "Git > Add" option

It will seem like nothing has happened, but trust me, the project files are added.

Now right click the project name again and this time select Git > Commit Directory.

Android Studio "Commit Directory" option

In the next screen, type a Commit Message and select Commit.

Android Studio "Commit Changes" option

If a Code Analysis warning appears, click Commit. (Unless it’s a real project, in which case review and fix the issue before committing!)

Android Studio "Code Analysis" warning

Now, right click the project name, select Git > Repository > Push.

Android Studio "Git Push" option

Check the box Push current branch to alternative branch and leave the branch name as master. Then select push.

Android Studio "Git Push" prompt

Now enter your GitHub Login (email address) and Password. Then click OK.

Android Studio GitHub Remote Login

If it’s all good, you will see this message.

Android Studio Successful Git Push

Now your code is pushed to your GitHub repository. Don’t believe me? Logon and check for yourself.

GitHub repository pushed from Android Studio

Hope that was helpful.

目录
相关文章
|
19天前
|
Java Android开发 C++
Android Studio JNI 使用模板:c/cpp源文件的集成编译,快速上手
本文提供了一个Android Studio中JNI使用的模板,包括创建C/C++源文件、编辑CMakeLists.txt、编写JNI接口代码、配置build.gradle以及编译生成.so库的详细步骤,以帮助开发者快速上手Android平台的JNI开发和编译过程。
68 1
|
6天前
|
XML IDE 开发工具
🔧Android Studio高级技巧大公开!效率翻倍,编码不再枯燥无味!🛠️
【9月更文挑战第11天】在软件开发领域,Android Studio凭借其强大的功能成为Android开发者的首选IDE。本文将揭示一些提升开发效率的高级技巧,包括自定义代码模板、重构工具、高级调试技巧及多模块架构。通过对比传统方法,这些技巧不仅能简化编码流程,还能显著提高生产力。例如,自定义模板可一键插入常用代码块;重构工具能智能分析并安全执行代码更改;高级调试技巧如条件断点有助于快速定位问题;多模块架构则提升了大型项目的可维护性和团队协作效率。掌握这些技巧,将使你的开发之旅更加高效与愉悦。
18 5
|
1月前
|
Dart Android开发
Android Studio New里面没有New Flutter Project
Android Studio New里面没有New Flutter Project
88 1
Android Studio New里面没有New Flutter Project
|
19天前
|
编解码 Android开发
【Android Studio】使用UI工具绘制,ConstraintLayout 限制性布局,快速上手
本文介绍了Android Studio中使用ConstraintLayout布局的方法,通过创建布局文件、设置控件约束等步骤,快速上手UI设计,并提供了一个TV Launcher界面布局的绘制示例。
30 1
|
20天前
|
Android开发
Android Studio: 解决Gradle sync failed 错误
本文介绍了解决Android Studio中出现的Gradle同步失败错误的步骤,包括从`gradle-wrapper.properties`文件中获取Gradle的下载链接,手动下载Gradle压缩包,并替换默认下载路径中的临时文件,然后重新触发Android Studio的"Try Again"来完成同步。
229 0
Android Studio: 解决Gradle sync failed 错误
|
20天前
|
Java Android开发 芯片
使用Android Studio导入Android源码:基于全志H713 AOSP,方便解决编译、编码问题
本文介绍了如何将基于全志H713芯片的AOSP Android源码导入Android Studio以解决编译和编码问题,通过操作步骤的详细说明,展示了在Android Studio中利用代码提示和补全功能快速定位并修复编译错误的方法。
31 0
使用Android Studio导入Android源码:基于全志H713 AOSP,方便解决编译、编码问题
|
20天前
|
API 开发工具 Android开发
Android Studio:解决AOSP自编译framework.jar引用不到的问题
在Android Studio中解决AOSP自编译framework.jar引用问题的几种方法,包括使用相对路径、绝对路径和通过`${project.rootDir}`动态获取路径的方法,以避免硬编码路径带来的配置问题。
32 0
Android Studio:解决AOSP自编译framework.jar引用不到的问题
|
1月前
|
Dart 开发工具 Android开发
Android Studio导入Flutter项目提示Dart SDK is not configured
Android Studio导入Flutter项目提示Dart SDK is not configured
68 4
|
1月前
|
Java 网络安全 开发工具
UNITY与安卓⭐一、Android Studio初始设置
UNITY与安卓⭐一、Android Studio初始设置
|
1月前
|
Android开发 数据安全/隐私保护
Android Studio创建JKS签名遇到的坑
Android Studio创建JKS签名遇到的坑
76 1