如何在Android Studio中从GitHub打开项目?麻烦与Maven和Android支持库。 [英] How to open the project from GitHub in Android studio? Troubles with Maven and android support libraries.

查看:248
本文介绍了如何在Android Studio中从GitHub打开项目?麻烦与Maven和Android支持库。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用Android Studio。我想从GitHub
打开项目 https://github.com/TonicArtos/StickyGridHeaders



在第一个屏幕上,我点击'从版本控制检出','GitHub',选择磁盘上的位置。
克隆后,我有个问题'您已经签出了一个Android Studio项目文件...您想打开吗?',我同意。
比我同意为Maven项目自动导入。
比找到项目'Examples',尝试构建它并得到'No resource found that match the given name name:AppCompat',并且导入android.support.v7.app.ActionBarActivity不起作用。



https://www.dropbox.com/s/ph04ogcr2txmge3/Screenshot%202014-07-24%2017.42.2p3



如何做这个示例应用程序?要求是保存使用'git status'和'git diff'命令的项目结构。

解决方案

有几个关于这个主题的SO问题,但@ MartinRevert的答案( https://stackoverflow.com/a/24978323/5025060 )是我发现提到Android Studio(AS's)Gradle依赖关系的唯一一个。如果Github项目是使用Eclipse构建的,那么将它导入到AS将会正常工作,但是结果不能使用AS 构建(指示:项目的Make project图标在AS中灰显)。



基于Martin的回答,并使用IntelliJ的从Eclipse项目迁移页面作为参考,我发现了一个简单而透明的方法来将基于Eclipse的Github项目导入到AS 2.1.2中:


  1. 使用AS导入Github项目:
    File-> New->项目从版本控制 - > Github
    这克隆了Github项目,但如果它不是Gradle项目(请参阅上面的内容),请按照以下附加步骤操作:
  2. 创建一个新项目使用:
    文件 - >新建>导入项目并在上面的步骤(1)中单击您存储项目的文件夹。接受所有的默认设置,AS会将Eclipse项目导入到现在可以构建的Gradle项目中。

  3. 现在可以删除(使用本机目录删除工具)您在上面(1)中创建的项目。

相关问题:


I'm starting to use Android Studio. I'd like to open project from GitHub https://github.com/TonicArtos/StickyGridHeaders

On first screen I click 'Check out from Version Control', 'GitHub', select place on disk. After cloning I have a question 'You have checked out an Android Studio project file… Would you like to open it?', I agree. Than I agree to auto-import for Maven project. Than I find the project 'Examples', try to build it and get 'No resource found that matches the given name Theme:AppCompat', and import android.support.v7.app.ActionBarActivity does not work.

https://www.dropbox.com/s/ph04ogcr2txmge3/Screenshot%202014-07-24%2017.42.22.png

What to do to make the example app? Requirement is to save the project structure for using 'git status' and 'git diff' commands.

解决方案

There are several SO questions on this topic, but @MartinRevert's answer (https://stackoverflow.com/a/24978323/5025060) is the only one I found mentioning Android Studio's (AS's) Gradle dependency. If the Github project was built with Eclipse, importing it to AS will work but the result will not be buildable with AS (indication: the project's "Make project" icon is grayed out in AS).

Building on Martin's answer, and using IntelliJ's Migrating From Eclipse Projects page as a reference, I found a simple and transparent way to import an Eclipse-based Github project into AS 2.1.2:

  1. Import the Github project using AS: File->New->Project from Version Control->Github This clones the Github project, but if it is not a Gradle Project (see above), follow these additional steps:
  2. Create a new project using: File->New->Import Project and click on the folder you stored the project to in step (1) above. Accept all of the defaults and AS will "import" the Eclipse project to a Gradle project which it will now be able to build.
  3. You may now delete (using a native directory removal tool) the project you created in (1) above.

Related questions:

这篇关于如何在Android Studio中从GitHub打开项目?麻烦与Maven和Android支持库。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆