【macOS】解决Gradle project sync failed.Basic functionality(e.g. editing,debugging) will not work pro...

第一次安装Android Studio,就发现我居然连运行个Hello World都有拦路虎。

发现程序报错,提示Gradle project sync failed.Basic functionality(e.g. editing,debugging) will not work properly。

然后各种百度,结果发现都没有用,

后来我决定用曲线救国,搜索报错的内容‘Unable to resolve dependency for ':app@debug/compileClasspath’发现有一篇文章说可能是被墙的问题。


1.于是我就照着这边文章操作修改了 gradle-wrapper.properties 文件中的 distributionUrl 的值为

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip



2.再修改了build.gradle(Module:app)。如果存在依赖包的话,再把所有的依赖包改成,implementation.

build后就开始报各个依赖包 Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.xxx.

android {

compileSdkVersion26

    defaultConfig {

applicationId "com.example.jon.helloworld"

        minSdkVersion15

        targetSdkVersion26

        versionCode 1

        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

buildTypes {

release {

minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'

        }

}

}


3.最后修改代理。唤出偏好设置界面。把http proxy代理指向本地


你可能感兴趣的:(【macOS】解决Gradle project sync failed.Basic functionality(e.g. editing,debugging) will not work pro...)