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!!
Related
I updated my Android Studio to Android Studio 3.4 and I'm trying to run one of my apps but it gives me an error.
com.android.tools.idea.run.ApkProvisionException: No outputs for the main artifact of variant: debug
Session 'app': Install failed.
Installation failed
Rerun
Solved it by going to Run => Edit Configuration => app (or your project name)
In the Before Launch section, I added Gradle-aware Make.
The hint came from comparing my project with the example screenshot available at https://developer.android.com/studio/run/rundebugconfig#opening
Try running your app after reloading your gradle project
Right click over your project under Gradle tab
You may be using an incompatible Gradle and Android Gradle plugin version.
Upgrade Gradle to version 4.1 at least
in gradle/wrapper/gradle-wrapper.properties
use:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
and in root build.gradle
modify the following lines (add Google maven repository and update plugin to 3.0.1):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
I had the same problem.
On the left there is a pane where all the files are displayed called "Build Variants"
I selected that and my main app module was set to debug-x86. I changed that to debug-x86-64 and it worked]1
In my case, delete Signed Bundle files you were created.
I downloaded my repository through git on a new computer, cloned everything, but when I ran a Gradle sync it failed with this error message:
I tried cleaning the project, invalidating caches / restart, redownload the whole repository, delete Gradle file and get it back from the repository. Nothing helped. Funny thing is, the guys at the office are building without a problem from the same Gradle file. Any idea what I'm doing wrong here? Btw, I checked all the 20+ threads here on SO with similar titles, but none of them described the same problem I'm having. However, I tried all the fixes suggested there, but that didn't show any results either.
After wasting a whole day on this I found out the core of the problem.It was a problem with Gradle. The links for these four dependencies pointed to pages, which returned 404, therefor Android Studio couldn't get the dependencies and threw this error. My temporary decision is to use a different Gradle version, in which the links point to the right pages.
Add google() in your app build.gradle.
1. buildscript {
repositories {
google()
jcenter()
.....
}
}
2. allprojects {
repositories {
google()
jcenter()
.....
}
}
Then try to build.
Open SDK manager and choose the target SDK version then click ok , it will start installing the version directly.enter image description here
Open File > Project Structure in window select versions as my.
After that sync gradle
resolve for me
When i try to start an old App with the InstantRun it says that:
Gradle build-info.xml not found for module app. Please make sure that you are using gradle plugin '2.0.0-alpha4' or higher.
How can i solve this?
With the recent release of Android Studio 2.0, there is a new Android gradle plugin 2.0.0. You can apply that in your top-level build.gradle buildscript block by changing the version of the plugin to look like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
EDIT: Some projects that were previously managed by Android Studio 1.5 may exhibit strange problems like this. To clear these problems, it may be required to delete the project's .idea directory and re-import it into AS 2.0.
It happend after updated to Studio 2.0,
I disable Instant Run function fix this issue
Update
After I upgrade android studio to version 2.1.1, enable instant run function. it works
Update2
It seems when I build release version, enable instant run is OK, not for debug version build. so strange.
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.
I cant seem to get build tools for the latest gradle at all. I suspect its something to do with proxy setting for gradle. I have had a good look online but still cant seem to find a solution. I use gradle 2.1.
I created gradle.properties file in my /home/user/.gradle folder with these setting.
systemProp.http.proxyHost=proxy
systemProp.http.proxyPort=80
systemProp.http.proxyUser=myusername
systemProp.http.proxyPassword=password
systemProp.https.proxyHost=proxy
systemProp.https.proxyPort=80
systemProp.https.proxyUser=myusername
systemProp.https.proxyPassword=password
Here is my global build.gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.0'
classpath fileTree(dir: 'build-libs', include: '*.jar')
}
}
allprojects {
repositories {
mavenCentral()
}
}
And here is the error i get when running gradlew
Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'.
peer not authenticated
What am I missing? that maven link opens fine in a browser.
Right, I'm not sure if it will work for others but worked for me.
I changed proxyPort to 8080 and used jcenter instead of Maven. But I had to apply expeption to use HTTP instead of HTTPS. This is what I have in my build.gradle for build script and allprojects
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
UPDATE: 06/08
I have recently updated Gradle and plugin version and had some problems. It was complaining about plugin com.android.application
I did some digging around and changed
jcenter {
url "http://jcenter.bintray.com/"
}
to
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
Find and Replace:
jcenter()
maven {
url "https://maven.google.com"
}
to:
maven {
url "https://maven.google.com"
}
jcenter()
For newer android studio 3.0.0 and gradle update, this needed to be included in project level build.gradle file for android Gradle build tools and related dependencies since Google moved to its own maven repository.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'm using Gradle plugin 3.0.1 and saw this error. Not sure what caused this but the solution that works for me is to stop the running Gradle daemon by ./gradlew --stop.
The solution is in your build.gradle change this block:
allprojects {
repositories {
jcenter()
google()
}
}
to google in first position :
allprojects {
repositories {
google()
jcenter()
}
}
late but it worked for me:
change your dns setting by going Network and sharing center.
In left pane choose change adapter setting
-right click on your network connection
-properties
-select ipv4
-properties
- now in dns server setting:-
-choose the option use the following dns server addresses
and use google dns server 8.8.8.8 as preferred dns server and
8.8.4.4 as alternate dns server.
it will solve your problem.
In the Android Studio v4.0, you should be off the Gradle offline-mode and retry to sync Gradle.
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 got the same problem. Just use File->INVALIDATE CACHES AND RESTART
6 years later here, but for them who are stil facing this issue, I solved it as following.
It happened when my module had a different gradle version than the main project. I had gradle version 3.5.3 in project and an older version in module. So, I Just updated that version. The file is here:
./node-modules/[module-name]/android/build.gradle
In my case deleting the .gradle folder worked for me.
In my case, my Android Studio version was 3.6.1 and i have modified the classpath like below;
classpath 'com.android.tools.build:gradle:3.6.1'
and that error was gone.
Go to
File --> Invalidate Caches / Restart.
It worked for me.
Android Studio > view > tool Windows > Gradle > click toggle offline mode (besides gradle settings icon)
this work for me :)
I had a same problem and I fix it with the following steps:
check the event log and if you see the errors like "cash version
is not available for the offline mode" follow the steps.
click on View => Gradle then new window will open.
click on the WIFI icon and then sync the Gradle.
"if you see different errors from what I mentioned in number one,
please go to the file -> project structure -> and there is suggestion"
Tools > SDK Manager > SDK Tools > Show Package Details
and remove all the old versions
I installed new Android Studio and faced with this problem. Nothing is helped me except of downloading a few more Android SDK versions:
Added Android Q and Android Pie to downloaded and installed SDK
Well if anyone facing with this problem after updating android studio to 4.2, the problem is about kotlin version. changing cotlin version line from "ext.kotlin_version = "1.5.0-release-764" to "ext.kotlin_version = "1.5.0" may solve your issue. Here is the link which has more information about it:
https://exerror.com/cant-create-new-kotlin-project-after-updating-to-android-studio-4-2/
You should have gradle-wrapper.properties inside gradle/wrapper folder.
Make sure you are using the right distributionURL, and the latest one. It should look something like this :
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
I Updated my android studio to latest version: Android Studio - Arctic Fox | 2020.3.1
Then it was showing this error. To solve this error, you have to follow these steps:
File>project Structure>project
Change Android Gradle Plugin version: 7.0.0 and Gradle Version: 7.0.2
then Go to file>setting>Build, Execution, Deployment>Build Tools>Gradle
change Gradle JDK to 11 version if it is 1.8 version.
if notification popup for Gradle upgraded then tap on it and click on run selected steps.
sync project and rebuild your project if necessary.
I hope it will work for you, Thanks me later.
I encountered a similar issue while building a Java project on Jenkins using Gradle.
When I run the build on Jenkins, at some point it throws the error below:
22:37:05 + GRADLE_OPTS='-Xms8192M -Xmx8192M'
22:37:05 + gradle clean build '-Dorg.gradle.jvmargs=-XX:MaxPermSize=4096M -Xms4096M -Xmx8192M' --full-stacktrace
22:37:05
22:37:05 Welcome to Gradle 5.6.4!
22:37:05
22:37:05 Here are the highlights of this release:
22:37:05 - Incremental Groovy compilation
22:37:05 - Groovy compile avoidance
22:37:05 - Test fixtures for Java projects
22:37:05 - Manage plugin versions via settings script
22:37:05
22:37:05 For more details see https://docs.gradle.org/5.6.4/release-notes.html
22:37:05
22:37:05 Starting a Gradle Daemon (subsequent builds will be faster)
22:37:14 > Task :my-service:clean UP-TO-DATE
22:37:18 > Task :my-service:compileJava FAILED
22:37:18
22:37:18 FAILURE: Build failed with an exception.
22:37:18
22:37:18 * What went wrong:
22:37:18 Execution failed for task ':my-service:compileJava'.
22:37:18 > Could not resolve all files for configuration ':my:compileClasspath'.
22:37:18 > Could not download spring-boot-autoconfigure.jar (org.springframework.boot:spring-boot-autoconfigure:2.1.14.RELEASE)
22:37:18 > Could not get resource 'https://nexus.my-test.network/repository/maven-public/org/springframework/boot/spring-boot-autoconfigure/2.1.14.RELEASE/spring-boot-autoconfigure-2.1.14.RELEASE.jar'.
22:37:18 > Premature end of Content-Length delimited message body (expected: 1276879; received: 496657
22:37:18
22:37:18 * Try:
22:37:18 Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Here's how I fixed it:
So first I looked the previous builds and they were building fine except this last one, also we had not changed anything in the build process.
The issue was with our Nexus artifactory server that has not been running fine. The server stops responding sometimes.
I just restarted the server and re-tried the build and it worked fine.
That's all
**A problem occurred evaluating project ':app'.
Could not resolve all files for configuration 'classpath'.**
Solution:
Platform->cordova-support-google-services
In this file
Replace
classpath 'com.android.tools.build:gradle:+' to this
classpath 'com.android.tools.build:gradle:3.+'
There seems to be many different causes to this problem. My cause is different from other posted answers, so I'll go ahead and explain what my problem was just in case it's useful.
I have a set of custom gradle plugins that for all practical purposes can be thought of as a wrapper around four familiar plugins: "com.android.application", "com.application.library", "java" and "java-library". These wrapper plugin are responsible for actually applying those familiar plugins, along with supplying configuration data. The result is that it simplifies the "build.gradle.kts" scripts for modules in my various projects.
My wrapper plugin for the "java-library". Is pretty straight forward. It applies the "java-library" plugin and adds the "sourceCompatibility" and "targetCompatibility" values. I followed the pattern that others have suggested on how to set those values. Essentially doing something like: "project.tasks.withType<JavaCompile> { sourceCompatibility = ... }" That's what caused my problem. I changed the above to:
val javaExt:JavaPluginExtension = project.extensions.get("java") as JavaPluginExtension
javaExt.sourceCompatibility = JavaVersion.toVersion( versions.getProperty("java-source-compatibility"))
javaExt.targetCompatibility = JavaVersion.toVersion( versions.getProperty("java-target-compatibility"))
And that solved the issue for me! The only useful information I got from gradle on resolving the problem is that it let me know the offending module, which was a module that didn't need any dependencies. In order to track down what was going on, I put the offending module into a separate project. That's where I discovered that the problem was definitely related to my custom "java-library" wrapper plugin.
I basically just removed jcenter() from my repositories of project gradle in buildscript block, since i declared it in my app gradle.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
mavenLocal()
mavenCentral()
jcenter() //remove this line
}
you should have gradle.properties file defined for the build with proxy settings so that gradle knows how to use http connection
# This file contains the basics for Maven Version control and will be used by the Artifactory Release management
# These settings are for the root project and all sub-projects in this application
releaseVersion=1.0.0-SNAPSHOT
releaseGroup=com.xx.xx.xx
artifactory_user=
artifactory_password=
artifactory_contextUrl=https://artifactory.xxxx.com/artifactory/
systemProp.http.proxyHost=proxy.xxx.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.xxx.com
systemProp.https.proxyPort=8080
systemProp.http.nonProxyHosts=*.xxx.com|localhost|*.int.targoe.com
org.gradle.java.home=C:\\Program Files (x86)\\Java\\jdk1.8.0_121
I had this issue and it was because I hadn't added an exception for gradle in my firewall (TinyWall).
I got this issue solved by switching internet from Wifi to mobile hot-spot. It means this issue occurs due to network issue. I could also see below logs which confirms my understanding,
Connect to jcenter.bintray.com:443
[jcenter.bintray.com/75.126.118.188] failed: Connection timed out:
connect
and
Connect to repo1.maven.org:443 [repo1.maven.org/151.101.36.209]
failed: Connection timed out: connect
Hope it helps.
If adding google() into your build.gradle doesn't work try adding it at first place in your repositories section of node_modules/YOUR_PACKAGE/android/build.gradle file.
I am working with flutter in the VS Code.
In my case, I solved it by
stopping gradlew process in VS code using the below command
android/gradlew --stop
I changed the ext.kotlin_version in "build.gradle" to the previous one (from 1.5.0 back to 1.4.32) and that worked for me. Maybe the current Gradle version wasn't compatible with it.