I'm totally new in android programming and by now just trying to run a "Hello World" program! But I couldn't! This is what I've done till now:
Previously I had android-studio-ide-171.4443003-windows installed on my laptop, and I installed all SDK Tools from SDK manager. But every time I wanted to sync a project it end up with this error:
ERROR: Could not find com.android.tools.build:gradle:3.5.0. Searched
in the following locations:
- file:/C:/Users/Pro/.android/manual-offline-m2/android-gradle-plugin-3.5.0-beta01/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- file:/C:/Users/Pro/.android/manual-offline-m2/android-gradle-plugin-3.5.0-beta01/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
- file:/C:/Users/Pro/.android/manual-offline-m2/gmaven_stable/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- file:/C:/Users/Pro/.android/manual-offline-m2/gmaven_stable/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.jar
Required by:
project : Open File
then I updated my android studio to android-studio-ide-191.5791312-windows32, and again it get that error! so I download android-gradle-plugin-3.5.0-beta01 and gmaven_stable from android developer site and as the site said, I extracted them and copy the content into [my home directory]\.android\manual-offline-m2. and then restart android studio, but the problem still exist!
Then I went to Settings > Build, Execution, Deployment > Gradle and checked the "Offline work" and specified the "Service directory path" as "[my home directory]/.android/manual-offline-m2/android-gradle-plugin-3.5.0-beta01" and again tried to sync the project, but sync got new error:
ERROR: No cached version of com.android.tools.build:gradle:3.5.0 available
for offline mode.
now I'm totally confused and don't know what should I do to solve this problem! If anybody help me I will really appreciate that.
Open android studio go to your project -> build.gradle -> edit this code
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
Try lowering your build.gradle version to classpath 'com.android.tools.build:gradle:3.4.2'
I think your android studio does not support that kind of classpath version.
Related
Could not find com.android.tools.build:gradle:4.1.
Searched in the following locations:
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
https://maven.google.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://maven.google.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar
Required by:
project :
Open File
I downloaded the source code of an app and when I try to run I get all kinds of gradle errors. I have been trying to solve it since two days but so far I have been unable to do so. I updated Android Studio to 3.1 but the error is still there. Nothing works.
Here is what I have tried so far:
I deleted all the gradle version in the 'dist' folder and let
Android Studio download everything again.
I have tried to enable
'offline mode' in the Gradle build settings in Android Studio.
I also enabled 'use local gradle distribution'.
P.S: Creating a new project works fine. I just need to run this specific project.
The Gragle version declared is 4.1, but since you are using Android Studio 3.1, the gradle version should be declared as follow into your application build.gradle:
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
...
}
}
You can find the link between the gradle plugin version and the actual gradle version here
I've installed Android studio 3.0.1 then tried to build very first app by choosing an empty activity, but I've got this message:
Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly
and the error message like this:
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
Could not resolve com.android.support:appcompat-v7:26.1.0.
Required by:
project :app
Could not resolve com.android.support:appcompat-v7:26.1.0.
> Could not parse POM https://dl.google.com/dl/android/maven2/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom
> Already seen doctype.
The first part of log message is like this:
2018-01-03 11:11:12,671 [d thread 8] WARN - ect.sync.idea.ProjectSetUpTask - Already seen doctype.
Consult IDE log for more details (Help | Show Log)
2018-01-03 11:11:12,671 [d thread 8] INFO - e.project.sync.GradleSyncState - Gradle sync failed: Already seen doctype.
I've tried some suggested solutions like changing gradle version, update Kotlin plugin(!) and so, but they didn't work.
Any solution?
This problem occurs when the Build Tools Version is not set for the project.
You just set the build tools version by following this process...
By opening your project structure [File->Project Structure] and selecting the Build Tools Version from app's property tab in Modules section.
This will add build tools version to your gradle file (Module:app) and re-sync the project.
The problem caused by my connection. I needed to set proxy to download some components.
For me the issue was one of the external libraries required SDK 28 but android studio didnt have it so it did not work. I installed SDK 28 and the problem was fixed. I saw the problem in the log file it generated
The error happens under fluctuating network. So at first make sure your connection is stable. Plus, if you are using any VPN check your gradle.properties is configured correctly.
The correct form of VPN connection on gradle.properties is as follows,
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8080
My host connection is 127.0.0.1, and its port is 8080 for both http and https.
Just one more thing, make sure adding https (It is mandatory).
I had the same problem when i was upgrading to android studio 3.1.2 and the problem i was using the previous JDK which i installed before 5 years back.
The steps:-
Go to File -> Project Structures -> SDK Location -> JDK Location -> check the
Option Use embedded JDK (recommended).
I tried all suggestions, only one works for me:
open 'Gradle' tab on right vertical panel
right click on project name
'Refresh Gradle Dependencies' and wait background downloading
right click on project name again
'Reload Gradle Project' and wait refreshing
I was also stuck with the same issue for quite few minutes till I figured out the solution:
So you have to visit Gradle Releases and
there scroll down a little bit and you will find the plugin version and required gradle version. Make sure you use the latest version of both or the ones which are compatible with each other.
For today I am using :
Android Gradle Plugin Version - 7.0.2
Gradle Version - 7.2
You can update it by navigating to:
> File -> Project Structure -> Project
Suddenly My Project showing this Error(Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly). Then i Try to various solutions but not solved.
Then i close the android studio, and open the project location and delete the .idea and .iml file, After deleting this file open the project again on Android studio, after that the project working fine.
I had the same problem, I did download gradle version and used it as a local distribution.
Settings/Build,../Gradle/Use local distribution.
Else you will have to reinstall all the software.
The solution is kinda of very simple.
It's because the "compileSdkVersion" that you are using
in your build.gradle (Module:app) is higher than the SDK installed in your Android studio.
Now, what to do?
Just go on SDK Manager and download an Api Level higher or equal to your "compileSdkVersion" and you're done
Look at the manifest, something may have to go wrong there. In my case I had this label
<uses-sdk android: minSdkVersion = "7" android: targetSdkVersion = "15" />, which was from an example.
Then the error is displayed, and the correspondent is now updated <uses-sdk android: minSdkVersion = "15" android: targetSdkVersion = "27" />
As #oyeraghib said,
Visit this link to check the compatibility of your Android Gradle Plugin in comparison with Gradle itself. I was using an older version of both and updated to version 7 in both.
File -> Project Structure -> Project
It may take a while. Wait for it to load.
change the grade version to the latest one in gradle-wrapper
Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly
Go to gradle scripts -> build gradle(app) -> made following changes:
Finally it works.
When I import an Eclipse project into Android Studio, I got this problem:
Gradle 'XNote' project refresh failed
Error:Could not determine the class-path for interface com.android.builder.model.AndroidProject.
Anyone knows why it happened? Thanks!
Just now i am facing the same problem.
1.Check classpath in build.gradle file.
change to
classpath 'com.android.tools.build:gradle:2.3.0'
then go to gradle-wrapper.properties, and change distributionUrl
distributionUrl=http://services.gradle.org/distributions/gradle-3.3-all.zip
and then rebuild the project. its help for me...
I think this will definitely helps you.
I have solved this problem.
Google doesn't update ADT any more, so when Eclipse export a project to gradle, it use an old gradle plugin version that Android Studio doesn't support.
First, you should check the version of gradle plugin that you have installed.
Open Android Studio's installation directory,then open the directory \gradle\m2repository\com\android\tools\build\gradle\, you will see all version you have installed.
Then open Android Studio, open tab 'Project -> Gradle Scripts', Edit file build.gradle, change the gradle plugin to newest version you have installed, such as 2.3.0:
[OPTIONAL] This step is not necessary, but if you do not do this, you may see this problem:
A problem occurred evaluating root project 'XXX'.
> org/gradle/initialization/BuildCompletionListener
Check the newest version of gradle you have installed at C:\Users\YOUR USER NAME\.gradle\wrapper\dists.
Then open tab 'Project -> Gradle Scripts', edit file gradle-wrapper.properties, modify the gradle version(attention: gradle, NOT gradle plugin) to the newest at the last line.
Finally, click Build - Clean Project, done!
If it still warning "Gradle project sync failed...", just click Try Again!
AT THE END, SOMEBODY HELP ME TO TRANSLATE MY ANSWER TO REAL ENGLISH THAT NO grammatical mistakes!!!
Just Update two things:-
1) Update your Build.gradle to
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
2) Update Gradle-wrapper.properties: (Change Android mode > Project mode then Extend Gradle and open Gradle-wrapper.properties)
Replace distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
By
distributionUrl=http://services.gradle.org/distributions/gradle-3.3-all.zip
This always resolves the issue. may it usefull for you
I got it working after upgrading build tools to version 25.0.0 in build.gradle:
buildToolsVersion '25.0.0'
And change project to use newest gradle version 3.3 with default gradle wrapper (File -> Settings -> Gradle)
In my case I removed folder .idea from the project and then restarting the studio automatically manages to all the required folder and gradle work.
First, delete your .gradle folder in the home directory then restart Android Studio.
Palanivelraghul was right. A Studio has to download the old version. Then it presented 3 different options after it was complete.
Choose the top option ~"Sync with 3.0.1".
Event Log:
Gradle sync started > Project setup started > Gradle sync finished > Executing tasks:
[:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar] > Gradle build finished.
I am absolute beginner with Android Studio (especially Gradle) and having big trouble getting Android Studio to work. I downloaded and installed the most recent version of Android Studio (0.8.0). I have set the JDK_HOME variable. However, after I create a new project, I always receive the following message:
Error:Unknown host 'jcenter.bintray.com'.
Enable Gradle 'offline mode' and sync project.
Learn about configuring HTTP proxies in Gradle
If I try to compile the project, I get the following message dialog:
After reading a post, I manually downloaded the Gradle binaries (latest, 2.0), extracted it onto the local drive, went to Settings and set the Gradle path to the respective directory using the following:
I also tweaked the build.gradle file under the project to point to the latest Gradle 2.0 version. However, now I get the following error message:
Error:A problem occurred configuring root project 'HelloAndroidStudio'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.0.+.
Required by:
:HelloAndroidStudio:unspecified
Failed to list versions for com.android.tools.build:gradle.
Unable to load Maven meta-data from http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml.
Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml'.
jcenter.bintray.com
Please can someone help. Being my first time with Gradle, I have been trying for so many days without any clue to the problem. Thanks.
Change the Gradle version to lower ones and restart the Android Studio, you may get it.
Add this in build.gradle
classpath 'com.android.tools.build:gradle:1.1.0'
Setting the http_proxy under appearance & behaviour -> system settings -> http proxy has solved the problem
Change to the latest classpath in the dependencies.
For AS 1.5.1 I will do like this :
buildscript {
repositories {
jcenter()
}
dependencies {
**classpath 'com.android.tools.build:gradle:1.5.0'**
}
}
Just now I updated my android studio from build 130.737825 to build 130.878379. When I create a project for the first time, I am getting following error.
Gradle: A problem occurred configuring project ':MyApplicationadfaldf'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':MyApplicationadfaldf:_DebugCompile'.
> Could not find any version that matches com.android.support:appcompat-v7:+.
Required by:
MyApplicationadfaldfProject:MyApplicationadfaldf:unspecified
What is the reason?
For others, who may be facing the same problem,
Go to Tools-> Android-> SDK Manager, and update all repositories. Now, everything will work properly.
Same issue in my project was fixed with this:
In Android Studio:
-> Go to File menu -> Settings -> Gradle ->
Now in Gradle Settings just check Use Auto-Import Now update Maven will be updated in Android Studio and this error should be gone.
http://tools.android.com/knownissues#TOC-Bundled-Maven-Repository
you need to install "android support repository"