Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle 4.1 issue on latest android studio 3.0.1

Tags:

android

gradle

Though I have an updated android studio I am getting the following error but I cannot find gradle 4.1 in the gradle folder but when I check file -> project structure -> gradle plugin is 4.

Error:Could not find com.android.tools.build:gradle:4.1. Searched in the following locations: file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.pom file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.jar https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.pom https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.jar 

And my build.gradle file is this. I set it to 23 because I need to run it on 5.0.1 phone.

apply plugin: 'com.android.application'  android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig {     applicationId "com.example.threewire.myapplication"     minSdkVersion 10     targetSdkVersion 23     versionCode 1     versionName "1.0"     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes {     release {         minifyEnabled false         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'     } } }  dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {     exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' } 
like image 841
threewire Avatar asked Nov 27 '17 16:11

threewire


People also ask

How do I fix Gradle issues?

For this, you have to connect your PC to the internet and you have to open your Android studio. After opening your project click on the Sync Project with Gradle files option. This will automatically download the new Gradle files and will fix the issue which is caused by the Gradle files.

Which Gradle version should I use in Android Studio?

For the best performance, you should use the latest possible version of both Gradle and the plugin. You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or update your Gradle version using the command line.


1 Answers

check your tools version, it should be 3.0.1

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

please note that google() repository is important. the newer plugin is posted there.

like image 150
Gaurav Singh Faujdar Avatar answered Sep 28 '22 05:09

Gaurav Singh Faujdar