I am using Android Studio 3.1.3. Gradle build sync failed. I used following method but there is no use of it. If there is any solution please tell me
maven { url "https://maven.google.com" }
Invalidate restart & caches
multiDexEnabled
true
Adding
mavenLocal()
andmavenCentral()
This is module level build.gradle file:
android { compileSdkVersion 27 defaultConfig { applicationId "com.developers.a_g.designapp" minSdkVersion 15 targetSdkVersion 27 buildToolsVersion '27.1.1' versionCode 1 versionName "1.0" multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree( dir: 'libs',include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support:design-v7:27.1.1' implementation 'com.rengwuxian.materialedittext:library:2.1.4' implementation 'com.szagurskii:patternedtextwatcher:0.5.0' implementation 'com.github.d-max:spots-dialog:0.7@aar' implementation 'com.squareup.retrofit2:retrofit:2.3.0' implementation 'com.squareup.retrofit2:converter-gson:2.3.0' } android { compileSdkVersion 27 defaultConfig { applicationId "com.developers.a_g.designapp" minSdkVersion 15 targetSdkVersion 27 buildToolsVersion '27.1.1' versionCode 1 versionName "1.0" multiDexEnabled true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree( dir: 'libs',include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.1.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support:design-v7:27.1.1' implementation 'com.rengwuxian.materialedittext:library:2.1.4' implementation 'com.szagurskii:patternedtextwatcher:0.5.0' implementation 'com.github.d-max:spots-dialog:0.7@aar' implementation 'com.squareup.retrofit2:retrofit:2.3.0' implementation 'com.squareup.retrofit2:converter-gson:2.3.0' }
This is project level build.gradle file:
buildscript {
repositories {
jcenter()
google()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
this is the correct form
implementation 'com.android.support:design:27.1.1'
Don't
Do
Make sure, you added below
Then
Clean-Rebuild-Build
.Upgrade to Android Studio 3.3 destroyed all my projects.
This was one of the problems today I ran into. And after wasting too much time to find a solution, here is the working gradle. By the time I fixed this, I had forgotten what actually I was working on. I really wonder why Google always ship their Android Studio with broken gradle files. Seems like Google engineers even themselves don't know how to write proper gradle, and nobody QAs Android Studio before its final release.
Module level gradle:
And the project level gradle:
First make sure that you using:
And your gradle be like:
And also update design implementation like below:
You get this error because com.android.support:design-v7 does not exist it exist without -v7, also you can check support libraries in this link any time to make sure you are using the correct library.
You should add
google()
repository to your dependenciesAdd the maven URL in all projects section as well and sync the gradle or try removing one by one external libraries and sync the gradle hope it helps