如何将项目正确导入 Android Studio?

How do I properly import a project to Android Studio?

如何正确地将项目从 github 导入到 Android Studio? 当我尝试从大约一年前的 github 导入项目时,我会遇到错误,并且没有功能项目。

https://github.com/baseball435/SpaceInvaders

如果我导入上面的项目, 我收到这条消息:

此外,我得到了一个笨拙的结构:

我认为这就是您需要的Importing github project。只需按照步骤操作即可。

  1. 为 Windows

    安装 git

    It can be downloaded for free from git-scm.com.

  2. Link git 可执行到 Android Studio

    Open Android Studio and got to Settings. In the Setting dialog open the page Version Control / Git. Here define the path to the git executable you have just installed.

  3. 从 Github

    获取存储库路径

    Go to the GitHub page and get the HTTPs path to your repository.

  4. 将 Git 项目导入 Android Studio

    Go to Android Studio and go to Menu / VCS / Checkout from Version Control / Git

To import into Android Studio, select File > Import, and then select the directory containing the project to import. A wizard will open and guide you through the rest of the import process. When the project import has finished, it will open up a file called "import-summary.txt" which lists all the steps taken during import and suggestions for next steps. For example, it may note files that were not migrated, it may note missing components in your SDK install, and so on.

我成功地从 Github 导入了项目。 我认为您应该只导入 SpaceInvaders-android 部分。 导入后,只需 gradle 重建即可。