While I am importing gradle project in eclipse, it is giving me this error.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'test'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve de.richsource.gradle.plugins:gwt-gradle-plugin:0.3.
Required by:
:test:unspecified
> Could not GET 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/de/richsource/gradle/plugins/gwt-gradle-plugin/0.3/gwt-gradle-plugin-0.3.pom'.
> peer not authenticated
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I am using internet via proxy connection. If that is the issue, where to specify the proxy settings inside eclipse. In General-->Network connections, proxy settings are already there
Please help.
NOTE: Please ensure the server is trustworthy before you follow these steps.
If you get any other error like this:
Could not GET 'https://some_server.com/some/path/some.pom'.
> peer not authenticated
Then you need to import a certificate :
open the 'https://some_server.com/some/path/some.pom' in your favorite browser
export the cert using the Steps to export cert from a web site
copy the cer into JDK_HOME/jre/lib/security folder
open a shell and go to JDK_HOME/jre/lib/security folder
then import the cer into java using the
keytool -import -alias <the short name of the server> -file <cert_file_name_you_exported.cer> -keystore cacerts -storepass changeit
It will prompt you to import the certificate, type yes and press enter.
Then restart your eclipse and try building the project.
ANSWER#2:Providing the correct fix after two Negative markings
Make this changes to the top-level build.gradle file.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
//jcenter()
jcenter {
url "http://jcenter.bintray.com/" <=THIS IS THE LINE THAT MAKES THE DIFFERENCE
}
}
}
allprojects {
repositories {
//jcenter()
jcenter {
url "http://jcenter.bintray.com/" <=THIS IS THE LINE THAT MAKES THE DIFFERENCE
}
}
}
ANSWER#1 (Although this is not accepted would like to keep this)
If you see "peer not authenticated errors , it does not necessarily mean that the application does not hold a valid certificate. It also could mean that connections are being reset by the firewall, load balancer, or web servers. Try (re)starting the application with the Administator privilege.
On Windows:
Ensure you have administrator privileges.
Right Click application icon -> Select "Run as Administrator"
On Linux:
Ensure you have root access.
type sudo "app execution script name"
Change your repositories to the following in the build.gradle
repositories {
maven {
url "http://repo1.maven.org/maven2"
}
}
After importing the certificate as suggested in the above answer, edit your gradle.properties file and insert the following lines (having in mind your proxy settings):
HTTPS:
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
HTTP:
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
Upgrading from java7 to java8 did the trick for me.
I had a strange case where I had to change the order of jcenter and maven to get rid of the error
Not working
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven { url "https://jitpack.io" }
}
}
Working
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
maven { url "https://jitpack.io" }
}
}
I try to modify the repositories and import the cer to java, but both failed, then I upgrade my jdk version from 1.8.0_66 to 1.8.0_74, gradle build success.
I found that this was failing because of transient network issues with my Artifactory server. Other fixes didn't work for me, but simply retrying the build worked.
I using Java 11 cause this issue, problem resolved with change to Java 8, maybe you can check your java version.
I'm using android studio 1.51 with Linux (Ubuntu 14.04 LTS) and got the same error message:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.github.PhilJay:MPAndroidChart:v2.1.6.
Required by:
dbtraining-dbtrainingandroidapp-517de26197d8:app:unspecified
> Could not resolve com.github.PhilJay:MPAndroidChart:v2.1.6.
> Could not get resource 'https://jitpack.io/com/github/PhilJay/MPAndroidChart/v2.1.6/MPAndroidChart-v2.1.6.pom'.
> Could not GET 'https://jitpack.io/com/github/PhilJay/MPAndroidChart/v2.1.6/MPAndroidChart-v2.1.6.pom'.
> peer not authenticated
I tried to move maven { url "https://jitpack.io" }, set it to http instead of https, activated the "accept non-trusted certificates automatically", added the ssl certificate manually ... but still no luck.
The solution was to switch from OpenJDK 7 to Oracle JDK 8:
Downloaded the files for the JDK from Oracle, I took the tarball
(jdk-8u101-linux-x64.tar.gz) - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Extract the files. The folder name is jdk1.8.0_101
Now switch to the directory /opt/ (nautilus hotkey: CTRL+L) and create a new folder
"Oracle_Java". Maybe this requires root access, so open nautilus
from the terimal with sudo nautilus
Copy the folder jdk1.8.0_101 to /opt/Oracle_Java Follow the
instructions from https://wiki.ubuntuusers.de/Java/Installation/Oracle_Java/Java_8/#Java-8-JDK: Do not forget to replace the version placeholder in the path with your version
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javaws" 1
sudo update-alternatives --install "/usr/bin/jar" "jar" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/jar" 1
sudo update-alternatives --set "java" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/java"
sudo update-alternatives --set "javac" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javac"
sudo update-alternatives --set "javaws" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javaws"
sudo update-alternatives --set "jar" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/jar"
You can check in the terminal with the command java -version if
your installation was successful.
Now to back to android studio and open the project structure
window by pressing the hotkey CTRL+SHIFT+ALT+S and go to SDK
Location. Here you can set the path to JDK, for example
/opt/Oracle_Java/jdk1.8.0_101
That's it! :)
I had this error and it was happening because of a VPN proxy issue. I disabled my VPN client and everything worked fine after. I used this command (on a Mac):
sudo /opt/cisco/anyconnect/bin/acwebsecagent -disablesvc -websecurity
Upgrading to the latest version of gradle fixed this for me.
update distributionUrl in gradle-wrapper.properties to use the latest version.
update gradleVersion in build.gradle to match that version.
An old one, but since I just had this issue with an install of Eclipse 4.11...
There is apparently an issue with JDK11 which could cause this (https://github.com/spring-projects/sts4/issues/208#issuecomment-469661129). When I reverted back to my existing install of JDK8, I no longer saw the error.
Removing .gradle directory fixed this for me. If u r getting this due to a caching issue this will help.
As suggested in some answers here, I installed Java 8 and error was gone. Seems like bug is related to Java 11.
I used jEnv to manage java versions.
brew install jenv
brew install --cask adoptopenjdk8
jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
jenv global 1.8
Selected answer didn't help, I just couldn't download said certificate using Safari...
I recently had this same issue on Gitlab pipeline that uses gradle to build .jar.
Failing build configuration:
gradle-build:
image: gradle:5.2.1-jdk11-slim
stage: build
script:
- ./gradlew clean
- ./gradlew bootJar
It turned out that I was using outdated and not-supported gradle Docker image and after upgrading to gradle:6-jdk11-alpine, build passed
In my case upgrading ca-certificates package that's used by openssl fixed this error.
I could download the erring file successfully using the browser and looking at previous answers on this question made me think of old root CA's at OS level and that actually worked.
Not specific to Ubuntu but leaving following url for reference
https://ubuntu.com/server/docs/security-trust-store
Related
I've got a gradle FAILURE:
..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."
Case description:
Attached to the project codebase the next libs:
APP/build.gradle
//(Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0"
testImplementation "io.mockk:mockk:1.8.5"
Updated the gradle-wrapper.properties
distributionUrl=https....gradle-4.4-all.zip to 4.7-all
after all of that gradle was built success
created the test calss
#TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestClass {
#Test
internal fun testName() {
Assert.assertEquals(2, 1 + 1)
}
}
ran the test and got the FAILURE message.
ran the Gradle build with a command line argument ./gradlew --warning-mode=all to see what exactly the deprecated features are.
As a result I couldn't build the app and I've got that FAILURE: message.
Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features are.
It will give you a detailed description of found issues with links to the Gradle docs for instructions how to fix your build.
Adding --stacktrace to that, you will also be able to pinpoint where the warning comes from, if it's triggered by outdated code in one of the plugins and not your build script.
Try this one
cd android && ./gradlew clean && ./gradlew :app:bundleRelease
The process below worked in my case-
First check Gradle Version:
cd android
./gradlew -v
In my case it was 6.5
Go to https://developer.android.com/studio/releases/gradle-plugin and you'll get the plugin version for your gradle version. For gradle version 6.5, the plugin version is 4.1.0
Then go to app/build.gradle and change classpath 'com.android.tools.build:gradle:<plugin_version>
My project was incompatible with Gradle 8.0 .Here's what worked for me:
First I wrote this line of code in the Android Studio terminal:
./gradlew build --warning-mode all
When you do that, you will be shown in the logcat what is found to be deprecated or an issue in your project, for me it was the jcenter() repository that needed to be removed in my settings.gradle file and also I needed to update classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21" to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30" in my build.gradle project file.
Once I did these things, my project built perfectly and installed on my emulator
I was getting this error. Turns out it only happened when I completely cleaned the RN caches (quite elaborate process) and then created a release build.
If I cleaned the caches, created a debug build and then a release build, everything worked. Bit worrying but works.
Note: My clean command is...
rm -r android/build ; rm -r android/app/src/release/res ; rm -r android/app/build/intermediates ; watchman watch-del-all ; rm -rf $TMPDIR/react-* ; npm start -- --reset-cache
Important - Answer work only for REACT-NATIVE VS CODE Terminal
In VisualStudio code, you have to run like below then that warning will be omitted.
react-native run-android warning-mode=all
If you run below then you will get the error in terminal
When running react-native run-android --warning-mode all I get error: unknown option --warning-mode'
in my case i updated the build.gradle file and make the classpath to latest version from 3.5.2 to 3.6.3
dependencies {
classpath("com.android.tools.build:gradle:3.6.3")
}
In my case adding multiDexEnabled true in Android/app/build.gradle file compiled the files.
I will look into removing this in the future, as in the documentation it says 'Before configuring your app to enable use of 64K or more method references, you should take steps to reduce the total number of references called by your app code, including methods defined by your app code or included libraries.'
defaultConfig {
applicationId "com.peoplesenergyapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true // <-add this
}
The following solution helped me as I was also getting the same warning.
In your project level gradle file, try to change the gradle version in classpath
classpath "com.android.tools.build:gradle:3.6.0" to
classpath "com.android.tools.build:gradle:4.0.1"
Update your third party dependencies. for example I updated dependency from
implementation 'com.github.ybq:Android-SpinKit:1.1.0' to implementation 'com.github.ybq:Android-SpinKit:1.2.0'. and in my case issue has been solved.
It work for me in this issue in a project of react-native:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
244 actionable tasks: 2 executed, 242 up-to-date
D8: Cannot fit requested classes in a single dex file (# fields: 67296 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
....
I Did this:
Uninstall the app from my device:
The number of method references in a .dex file cannot exceed 64k API 17
Set distributionUrl path in gradle-wrapper-properties files as :
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip
Solution for the issue:
deprecated gradle features were used in this build making it incompatible with gradle 6.0. android studio
This provided solution worked for me.
First change the classpath in dependencies of build.gradle of your project
From: classpath 'com.android.tools.build:gradle:3.3.1'
To: classpath 'com.android.tools.build:gradle:3.6.1'
Then make changes in the gradle-wrapper.properties file this file exists in the Project's gradle>wrapper folder
From: distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
To: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Then Sync your gradle.
Uninstall the old app from the device/emulator. It worked for me
i'am using react-native and this works for me :
in root of project cd android and gradlew clean
open task manager in windows
on tab 'Details' hit endtask on both java.exe proccess
long story short
> Task :app:installDebug FAILED Fixed by kiling java.exe prossess
Solved this issue by deleting the .gradle folder from /android and again run npm run android, and it solved this error.
Here's a link to the issue: https://github.com/facebook/react-native/issues/28954
I am using react-native if all above didn't work delete Build and .gridle folder inside the Android folder and run again, That solved my problem
Go to gradle/wrapper/gradle-wrapper.properties change the distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip to the release that is needed (or higher).
Then run again cd android && ./gradlew bundleRelease
Finally decided to downgrade the junit 5 to junit 4 and rebuild the testing environment.
On a SpringBoot project using IntelliJ and Gradle, I got the warning "Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0" when running my integration test.
What solved the problem was:
- Going to: File > Settings > Build, Execution, Deployment
- Selecting for "Build and run using": Intellij IDEA (instead of "Gradle")
- Same for "Run tests using"
That did not explain why Gradle is displaying the warning, but that let me perform the test and progress in my work.
I found my disk space is less than 4 GB and can not get the Gradle lib repo
then show
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
just remove tmp and junk files, free up space then try build and resolve problem
In my case deleting the whole android folder from the base directory and allowing it to rebuild all of it on eas build fixed this error for me :)
1)cd android
2) ./gradlew clean
3)./gradlew :app:bundleRelease
then last install npm install command
it is due to incompatibility.
please upgrade classpath("com.android.tools.build:gradle:4.0.1") in build.gradle file under android folder.
Check settings.gradle script and remove jcenter() from that it may be causing the issue as it is deprecated.
You're new settings.gradle file should be
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
plugins {
id 'com.android.application' version '7.1.0-alpha12'
id 'com.android.library' version '7.1.0-alpha12'
id 'org.jetbrains.kotlin.android' version '1.5.21'
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "ComposePlayground"
include ':app'
Take note that ComposePlayground is app name.
I Sloved this problem by updating my gradle-wrapper.properties file. You have to change this line distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip to the lates gradle build which can be found at The Gradle Wrapper.
Hope that helps someone out there :)
After none of the above answers worked for me, I managed to solve this issue by upgrading the Gradle plugin to the latest version and using the JDK 11.
Hope this helps someone!
Try this solution worked for me.
If you have another app with the same name (or package name) on the device: Rename the app or delete it from your device.
For me, the problem was that I ran out of space in my device's internal storage. After deleting a few unnecessary apps, it worked fine.
After hours of searching on the web I used this command:
react-native run-android warning-mode=all
on vs code.
And it turns out that the error have nothing to do with deprecated modules or any gradle error, it was just that my device was full of storage.
I hope it will help someone one day.
I am getting the following error while running the build
FAILURE: Build failed with an exception.
* Where:
Build file '/home/charming/mainframer/bigovlog_android/buildSrc/build.gradle.kts' line: 4
* What went wrong:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '1.2.6'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:1.2.6')
Searched in the following repositories:
Gradle Central Plugin Repository
my buildSrc/build.gradle.kts
repositories {
jcenter()
}
plugins {
`kotlin-dsl`
id("groovy")
}
dependencies{
gradleApi()
localGroovy()
}
I tried everything but still not working
Did you check that Android Studio wasn't running in Offline Mode? Take a look at Preferences/Build, Execution, Deployment/Gradle/Global Gradle settings and see if Offline Work is checked.
In my case, my company is using a proxy behind the network.
So it must be an SSL handshake fail issue.
To fix this issue, I use KeyStore Explorer.
Follow these steps.
Download KeyStore Explorer and install it on your system. (In my case Windows10 OS)
Run KeyStore Explorer and open the cacerts file, if you are using Android Studio on Windows 10, it's here: C:\Program Files\Android\Android Studio(or Preview)\jre\jre\lib\security with password changeit.
On the toolbar, go to Examine -> Examine SSL, insert these values and click OK.
SSL Host: plugins.gradle.org
SSL Port: 443
Click the Import button and OK.
Save the file, and go to Android Studio, run Invalidate Caches / Restart.
If Android Studio is reopened, try Sync Project with Gradle Files again.
Please leave a comment, if you have more questions.
The same exact build file works for me. Try clean Gradle cache in both your project and home directory and check if it will work then. If it will still fail, try to update Gradle and the plugin to the latest version id("org.gradle.kotlin.kotlin-dsl") version "1.3.2"
I have the same problem and I try gradle --info
the log is below:
Evaluating project ':buildSrc' using build file '/Users/fjh1997/mirai/buildSrc/build.gradle.kts'.
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond
Retrying request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond
Retrying request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond
It seems that pass requests to proxy 127.0.0.1:1083.However what url I set proxy in local gradle.properties file is 127.0.0.1:8118.What's wrong with that?After long time's efforts,I find it out.
Actually,there are two gradle.properties configuration files in your system , one is in your project/.gradle,another is in ~/.gradle.And the latter is the global setting for gradle.
If the global setting has set variables for systemProp.http.proxyHost, then whatever you set in project/.gradle/gradle.properties, proxy dosen't work at all,you have to change it in the global setting.
And BTW,I find that the global setting for gradle is changed by my android studio preference.
I recently upgraded to Android Studio 1.5. However, after update, Gradle gets stuck at "Refreshing [project] Gradle Project" and never stops.
Previous version of Android Studio worked just fine.
How do I solve this?
I am on an Ubuntu 15.10 64bit machine.
Edit:
So far, I have tried deleting Android Studio from /opt and downloading the latest version. Didnt help.
I also tried removing the ~/.AndroidStudio1.5 directory. To no avail.
This is in my "Event Log"
Gradle sync started
NullPointerException: null
In your Android Project change gradle-wrapper.properties file, which is in *project/gradle/wrapper:
From:
distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip
To:
distributionUrl=https://services.gradle.org/distributions/gradle-2.8-all.zip
And also change the project build.gradle like below:
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
In your build.gradle for the project, update your classpath to gradle 1.5.0
Example:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
go to Preferences > Build, Execution > Build Tools > Gradle and change the Gradle Home path. I had to change mine because it had the wrong value, it was /Applications/Android Studio.app/Contents/gradle/gradle-2.4 and I changed it to /Applications/Android Studio.app/Contents/gradle/gradle-2.8
I had the same problem. My JAVA_HOME wasn't set to the right directory. Ehsun Mehranvaris answer is more like a hack, than a solution. I tried to built the android project per terminal with ./gradlew and it told me JAVA_HOME wasn't set correctly.
To get the path of your java enter in terminal:
readlink -f $(which java)
Set your JAVA_HOME like this in terminal:
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre
After that, I switched to the android project directory in the terminal and did run this command:
./gradlew
This will build your project and in my case it downloaded the latest gradle 2.8 package. Android Studio might download the package itself, if you set the JAVA_HOME correctly. Didn't try that.
Now you can use the default gradle wrapper from Android Studio and don't need to edit any property file manually. You find that at Preferences > Build, Execution > Build Tools > Gradle
I've just updated to Android Studio 1.3, opened an existing project I was working on, tried to run it. Gradle just gets stuck at the "Resolve dependencies':app_debugCompile'", I tried to wait, I waited for over an hour and nothing happened.
How can I solve it to get my app running?
If you are using proxy, it seems https proxy server setting is not correctly done in Android studio 1.3.
You can set https proxy server manually in gradle.properties,
systemProp.https.proxyHost=proxy.server.address
systemProp.https.proxyPort=8080
see Gradle Sync fails in Android studio 1.3 and gradle behind proxy in Android Studio 1.3.
How can I solve it to get my app running?
Start by identifying the problem more precisely. To do so, run gradle from the command line in the root directory of your project :
./gradlew --debug clean build
The --debug argument will simply enable the debug log level and hopefully providing useful information to understand where/why it is hanging.
I face this problem in linux and my problem solved after installing these dependencies on fedora :
sudo dnf install glibc.i686 zlib.i686 libstdc++-devel.i686
I had this problem.Just see this page. Solution is here
Solution :
Make sure you have latest stable version ( current 2.0.0 )
Make sure your gradle version is 2.0.0 in build.gradle ( classpath 'com.android.tools.build:gradle:2.0.0')
Final step and most important one is change your jcenter() to mavenCentral()
So you can easily add new dependency and sync project under 3sec !
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Go to app > Right Click on it > Open Module Settings>Change build tool version to 22.0.1
Try again after restarting your Android Studio
I've just encountered this issue in the OP, in my case it was taking over 20min just to get gradle build going. Getting stuck at the "Resolve dependencies':app_debugCompile'" as well.
I'm still relatively new to Stackoverflow so I can't up-vote yet. But what I can tell you is that if your behind a web proxy like I am and you've just updated to Android 1.3.1 you will probably notice this issue immediately. I already had my companies web proxy in the IDE settngs and yes there is something not ok with the 1.3.1 update. As corochann posted you have to add the proxy info to the gradle.properties of your project. Once I actually did this I noticed the difference immediately. Going forward until its resolved you'll probably have to add this to each project if your behind a web proxy and running 1.3.1. I have another machine at home that isn't behind a proxy and is running Android Studio version before 1.3.0 and had no issues. Hope this helps!!
I have already created one project and gradle sync worked successfully.
When I try to create another project it fails and gives the error message that
Gradle '<ProjectName>' project refresh failed
Error:Cause: peer not authenticated.
I have setup SDK, gradle gave gradle VM options
-Dhttp.proxyHost=<proxy.address> -Dhttp.proxyPort=<port> -Dhttp.proxyUser=<username> -Dhttp.proxyPassword=<password>
And in HTTP proxy tab also I have given the correct options.
Can anyone help me?
This was the solution that worked for me. Posting here in case it helps someone.
Gradle version was not correct in project build.gradle file.
I had
classpath 'com.android.tools.build:gradle:1.0.0'
but this needed to be
classpath 'com.android.tools.build:gradle:2.1.0'
Note:
This should be updated to the newest version of gradle tools which can be found here
Android Studio also recommends the latest plugin version.
DO NOT change your package source to http instead of https. Stop using these workarounds and fix the root cause.
Do you want to have a driveby exploit in your app? Because that's how you get a driveby exploit in your app!
The source of this problem Certificate Authority keystore. Somehow dpkg seems to try to build the Java keystore (/etc/ssl/certs/java/cacerts) before it actually installs Java, which the the tool to build the store requires. The result is an empty store:
To fix this, properly build the keystore with all trusted CA certificates.
Run this with sudo:
sudo rm /etc/ssl/certs/java/cacerts
sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure
You should see a long list of added certificates (*.pem) and finally a “done”.
Re-sync the project using gradle, and all will download. Don't forget to turn off the http override if you've set it!
Source: https://justus.berlin/2015/01/connection-problems-with-ssltls-peers-in-java-on-ubuntu-server-14-12-with-fix/
This error says that you're trying to connect using HTTPS protocol, but your client unable to validate server's certificate - usually because it is self signed.
Connect to https://jcenter.bintray.com with your browser, and check the certificate chain. The root certificate should be issued by GeoTrust Global CA. If it's not the case, your Internet Provider or your employer perform MITM to your HTTPS connections.
If you trust them, the simple workaround will be to add those self-signed certificates into JDK's cacerts keystore. Examples for how to do that: Windows; Linux/Mac.
Usually this error happens when you're under a company proxy. My solution on MAC was this:
Identify the Certificate is being used by your https connections
Open Key Chain Tools (cmd+space key chain)
Identify the certificate found up and export it to certificate.cer file
Open the terminal and navigate to your JAVA JRE security folder:
cd /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/security
Import the certificate with the following command:
sudo keytool -import -alias somealias -file /PATH_TO_EXPORTED_CERTIFICATE/certificate.cer -keystore cacerts -storepass changeit
That is done. Open Android Studio and it will fix the gradle build.
It's a dumb answer, but what fixed this for me was restarting Android Studio.
I was using Charles Proxy off and on, I suspect that had something to do with the cause of the error. Closed the proxy and restarted android studio, and it worked. Figured I would post because sometimes the answer is so simple we forget to even try it.
I closed my studio and when I re-opened the project, I got a window to enter proxy information. In that, I had to check the check box which said "Enable HTTPS proxy" and that worked for me!
please change the gradle build tools version first. You need to update the build tools version. Still not working, create a new project and check the gradle file details. 1.5.0 is the latest version I have installed.
classpath 'com.android.tools.build:gradle:1.5.0'
After meddling with it, and following Schizo's answer (you should follow it also), and it not working. I realized Android Studio was using java-7-openjdk but I added a certificate to java-8-openjdk, so it didn't work until I changed it to the openJDK 8 in Project Structure, so be sure that you check that also, in case it's not working for you.
THis fixed it for me after wasting lot of time trying various solutions:
Check the dependencies -> classpath in build.gradle file of project
dependencies {
classpath 'com.android.tools.build:gradle:2.10'
}
Changed this to classpath 'com.android.tools.build:gradle:2.0.0-rc1 in my case to fix the issue . To know the correct version to be used, made a new project and checked the build.gradle file .
Hope this helps.
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
}
I change classpath com.android.tools.build:gradle:1.1.3' to com.android.tools.build:gradle:1.0.0
There is one more small change can help you in
gradle-wrapper.properties
Change
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
To
distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip
Sync the project once you did the change
I also faced the same issue and the problem was related to certificates.
1: So first step is go to Build-> Clean Project. It will give you the details about the error.
2: Copy URL which is failing from the stack-trace. For eg build is failed to download some file, stack-trace will have the information of the URL.
3: Open the url in a browser, if you are able to open it that means your proxy settings are fine but java is unable to trust the source to download it.
4: So you need to copy the certificate manually and put in the jre certificates. And rebuild should resolve the problem.
5: Or if you have the latest jre verison, it might solve the problem.
As this occurs I using Ubuntu: When I changed version on android studio 2.0 9 preview beta 1.
How do I fix my gradle.
Simply created a new project in android studio and then went in and saw build.grandle version gradle in my case:
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta1'
}
and replace in my project.
I hope it helps others.
In my case I had to download the latest Java SDK and then change the JDK location in the project to the downloaded JDK. Apparently something was wrong with the current JDK (had some warning from my virus scanner about this)
In case this helps someone, I had the same issue and even though I set the proxy through the studio settings ( which adds the values of systemProp.http.proxyHost and systemProp.http.proxyHost to gradle.properties), https proxy was not set, so I added this in gradle.properties
systemProp.https.proxyHost = <your proxy host>
systemProp.https.proxyPort = <your proxy port>
and problem solved!
answer share from here https://stackoverflow.com/a/37962441/4030497
in case when there are some problems with internet,
try to add a line
54.231.14.232 s3.amazonaws.com
to your /etc/hosts (..\Windows\System32\drivers\etc\hosts)
Make sure you have specified latest gradle version in build.gradle file and latest distributionUrl in gradle-wrapper.properties file. Check network connetivity is proper or not [ Network connection should be without firewall/other settings which can stop upgrading gradle]
distributionUrl=http://services.gradle.org/distributions/gradle-2.1-all.zip
keep the http://
I have the same problem and salve it,My conduction is I define the HTTP proxy and I use agent to connect the server. Actually, you don't need proxy to connect jcenter
Changing my build.gradle to shown below worked.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Update your gradle to the latest version .
It works perfectly .
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
I hope it helps.
May be sometimes your app use Crashlytic bundle in your graddle
And your network cannot resolve Crashlytic library. In another way, may be others lib can cause problem. Please check your internet can access and grep those libs.
So it return an error that
"Error:Cause: peer not authenticated."
For me, I solve this problem by comment code that evolved crashlytics lib all
and compile again ---> this problem drain my working time to 4 hrs to know and clear it.
T ^ T
Wish all of us safe from this problem.