Android Studio 无法识别 Gradle 项目 [英] Android Studio not recognising Gradle projects

查看:49
本文介绍了Android Studio 无法识别 Gradle 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论我导入什么项目,它们都不起作用 - Android Studio 总是标记 这不是 Gradle 构建项目.

No matter what projects I import they never work - Android Studio is always flagging this is not a Gradle build project.

我选择VCS ->GIT 并克隆 repo 没有任何问题.然后我毫无问题地通过向导(我选择 create project from existing sources),创建我的代码库,下面有一个警告.当我尝试运行时会抛出各种错误.

I select VCS -> GIT and clone the repo without any problem. I then go through the wizard with no issues (I select create project from existing sources), creating my code base with a warning, below. When i try to run throws all sorts of errors.

将项目迁移到 Gradle?此项目不使用 Gradle 构建系统.我们建议您迁移到使用 Gradle 构建系统.有关迁移到 Gradle 的更多信息.

Migrate Project to Gradle? This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system. More Information about migrating to Gradle.

不再显示此消息.

当我转到链接时,它对我来说毫无意义,它说要创建一个任意的 Gradle 文件并用我的引用填充它(我认为),这超出了我的理解.我不应该这样做,因为它在存储库说明中说它实际上是一个基于 Gradle 的项目.

When I go to the link it makes no sense whatever to me, it says to create an arbitrary Gradle file and populate it with my references (I think), which is out of my understanding. I shouldnt have to do this as it says in the repository instructions that it is in fact a Gradle-based project.

我要克隆的项目是https://github.com/googlesamples/android-play-location.git

谁能具体告诉我例如如何在 Android Studio 中导入和运行以下 git repo?

Can anybody tell me specifically how to import and run the following git repo in Android studio for example?

推荐答案

从一开始就OK(因为我不知道还有什么其他方法有效)

Ok from the start (as i dont know what other way works)

  • 转到 Git 母版页(它有下载到 zip"或克隆到桌面"按钮).使用 https://github.com/googlesamples/android-play-location 作为如果您想确保没有其他问题,请测试母版页.
  • 点击下载压缩包"
  • 解压项目
  • 在 Android Studio 中关闭当前项目 -> 文件/关闭项目
  • 将出现这样的弹出屏幕,选择导入项目(Eclipse ADT、Gradle 等)
  • 您将被要求选择项目,在主文件夹中选择您解压的项目,例如 basicLocation
  • 默认选择从现有资源创建项目"
  • 不要更改项目名称(可能会导致问题)
  • 接下来通过'导入项目 -> 目录'
  • 接下来通过项目 -> 库
  • Next 通过导入项目 -> 模块和模块依赖
  • 接下来通过导入项目->SDK
  • 接下来通过导入项目->manifest.xmls
  • Android Studio 启动.确保配置下拉列表中有一个名为app"应用程序的项目
  • 选择同步 Gradle"图标(绿色圆圈)
  • 可能会收到语言警告,忽略或接受重启,没关系
  • Go to Git master page (it has 'download to zip' or 'clone to desktop' button). use https://github.com/googlesamples/android-play-location as a test master page if you like to ensure you have no other issues i did not.
  • Click 'download zip'
  • Unzip the project
  • Close the current project in Android Studio -> File/Close Projects
  • A popup screen like this will appear, choose Import Project (Eclipse ADT, Gradle etc.)
  • You will be asked to select the project, select your unzipped project within the master folder, eg basicLocation
  • Select 'create project from existing resources' default
  • dont change project name (may cause issues)
  • Next through 'import project -> directories'
  • Next through project -> libraries
  • Next Through import projects -> modules and module dependencies
  • Next through import project ->SDK
  • Next through import project ->manifest.xmls
  • Android Studio starts. Ensure the configurations dropdown has a project in it called 'app' app
  • Select 'sync Gradle' icon (green circle)
  • May get language warning, ignore or accept restart, doesnt matter

在底部它现在应该说Gradle execution tasks",之后它将在设备或模拟器上运行:)

At bottom it should now say 'Gradle executing tasks' after which it will run on device or emulator :)

这篇关于Android Studio 无法识别 Gradle 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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