Java error: unable to find method jcenter() in repository container for parameter []
I recently updated Android studio from 1.5 to 2.0, but Iam was unable to compile the existing project. When I built the project from the terminal, the following error occurred
gradle build –stacktrace
Alle @ alle-inspiron-3537: ~ / androidstudioprojects / newsletter $gradle build – stacktrace note: in order to comply with the org.gradle.jvmargs and / or org.gradle.java.home values specified for this build, a new JVM must be derived. In order to avoid the speed reduction associated with this additional process, You may need to consider running gradle with the daemon enabled. Please http://gradle.org/docs/1.4/userguide/gradle_ View the user's guide section on the daemon on daemon.html
Failed: build failed with exception
Where: build file "/ home / all / androidstudioprojects / newsletter / build. Gradle" line: 5
What went wrong: there was a problem evaluating the root project "newsletter"
Try: run with the – info or – debug option to get more log output
build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.+'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.gradle (application)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "design.iith.newsletter"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile files('libs/volley.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
}
Gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
resolvent:
I know this is one month old, but because I have the same problem, I just want to release my solution. The console on Android studio may use an older version of gradle. Use it to check gradle – version
If the gradle version is lower than 2.0, you and I have the same problem
You should upgrade your system gradle using the following methods
sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt-get install gradle-ppa
Get the latest gradle installation