Install Failed. Please check your network connection and try again.you may creating your project.

前段时间安卓方面遇到了瓶颈,就搁置了一段时间在忙着其他事情。这两天突然又来了兴致,翻到了一个特别好的源码,但是在导入到我的android studio里面的时候出现了一点问题,可能是版本的问题。

错误详情如下:

Install Failed. Please check your network connection and try again.you may creating your project.

这种错误网上解决方法很多,但是可能错误不太一样吧,有的对于我的错误就不太适用。下面我就把我的解决方法粘贴出来供大家参考:

①先把工程调节到android格式:

Install Failed. Please check your network connection and try again.you may creating your project.

②展开菜单最下方的Gradle,点击Project的Gradle

Install Failed. Please check your network connection and try again.you may creating your project.

③修改里面的代码如下:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
//        google()
        maven { url 'https://maven.google.com/'
            name 'Google'}
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

其中最主要修改:

allprojects {
    repositories {
//        google()
        maven { url 'https://maven.google.com/'
            name 'Google'}
        jcenter()
    }
}

然后重新运行工程就可以了。