如何将现有的 android 项目(build.gradle)打开到 android studio

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25645910/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 09:36:37  来源:igfitidea点击:

How to open existing android project(build.gradle) into android studio

androidandroid-studioandroid-gradle-pluginbuild.gradle

提问by Manoj

I am new to Android Studio.I have an existing android project which was build from android studio. now I need to openthat project from build.grade(that project's file)file.I followed this step File-->Open-->build.gradle(from that existing project)
But it shows the processing window as below image for so Long time doesn't responding well.

我是新来的Android Studio。我有一个现有的 android 项目,它是从 android studio 构建的。现在我需要open从 build.grade(那个项目的文件)文件到那个项目。我按照这个步骤 File-->Open-->build.gradle(from that existing project)
但是它显示处理窗口如下图这么长时间反应不好。

So any one have idea about this please help me.

所以任何人对此有想法请帮助我。

enter image description here

在此处输入图片说明

回答by Dave Doga Oz

First, we need your build.gradle

首先,我们需要你的 build.gradle

Second, i can make a guess from what you have posted till now.

其次,我可以从你到目前为止发布的内容中进行猜测。

  • Check your build.gradle for unused or missing projects in your project directory by checking dependencies area
  • 通过检查依赖项区域来检查您的 build.gradle 项目目录中是否有未使用或丢失的项目

as i can understand from "error listing versions of com.android.support:support-v4 using class org.gradle.api.internal.artifacts.repositories.resolver.MavenVersionLister$1. will attempt an alternate way to list versions. This behaviour has been deprecated and is scheduled to be removed in gradle 2.0" this.It may be related to repositories.

正如我可以从“使用类 org.gradle.api.internal.artifacts.repositories.resolver.MavenVersionLister$1 的错误列表版本的 com.android.support:support-v4 中了解到的。将尝试另一种方式来列出版本。这种行为有已弃用,并计划在 gradle 2.0 中删除“ this.It可能与存储库有关。

Check whether you have this or not in dependencies area. If something else is written there, remove it and add the correct one that i wrote below.

检查依赖项区域中是否有这个。如果那里写了其他内容,请将其删除并添加我在下面写的正确内容。

dependencies {
    ...
    repositories {
        mavenCentral()
        mavenLocal()
    }
...
}
  • and my another guess is, there is something wrong in your support-v4 library implementation
  • 我的另一个猜测是,你的 support-v4 库实现有问题

check whether you have

检查你是否有

    dependencies {
...
        compile 'com.android.support:support-v4:22.2.0'
...
    }

this or not. If not , add the line starts with compile that i wrote above. And If you have something like,

这与否。如果没有,请添加以我上面写的 compile 开头的行。如果你有类似的东西,

compile project(':support-v4')

compile project(':support-v4')

remove that line.

删除该行。