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'**
}
}
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 have installed Android studio and i have created the new project but it is giving me the error:
Gradle 'MyApplication2' project refresh failed
Gradle sync failed: Access is denied
I have also run android studio as an administrator but it did not work. Please help me with this. How can I build the gradle and run the project.
I have had a similar issue recently when the gradle plugin release was updated to 5.1.1. which caused an error message "apollo\generatedIR\debug (Access is denied)".
In order to fix this I had to revert back to the previous gradle version which was 3.3.2 and I had to make sure that the zip file that is downloaded when the project syncs matched the 3.3.2 version.
Here is where to check the versions of the gradle builds: https://developer.android.com/studio/releases/gradle-plugin
The changes I made where:
In the gradle (project) file change the classpath plugin to the previous version:
classpath 'com.android.tools.build:gradle:3.3.2'
Then in the gradle-wrapper.properties file change the distributionUrl to match the required gradle version.
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Then resync your project. If it doesn't work double check your gradle files by going to the C:Users//.gradle/wrapper/dists folder and it should match the version on the web page above.
if there is permission related issue. Then you can change the gradle path from C to D drive. it will fix the issue
Go to your project folder right click ->Properties->under Security tab on it check permission and allow all permissions.
I am new to Android Studio IDE. I have created a sample project using Android Studio and when I tried to build it, it comes with the following error.
Error:A problem occurred configuring root project 'SampleApp".
> Could not resolve all dependencies for configuration ':classpath'.
> Could not download artifact 'org.bouncycastle:bcprov-jdk15on:1.48:bcprov-jdk15on.jar': No
cached version available for offline mode
Can anyone please figure out what I did wrong.
It needs to download that library in order to do your build, but you've (perhaps inadvertantly) put Android Studio into offline mode. To fix it, go to Preferences > Gradle and ensure that the "Offline work" checkbox is not checked.
I think you should add following code at the top level of your build.gradle:
repositories {
mavenCentral()}
You might also need to try with --refresh-dependencies.
You can take more help from this here.
Using the new project wizard to create a new Android application, The IDE gets stuck before I can even see the Code files. After trying to create many types of projects, It tells me that it is building and the IDE only shows a Loading box that says either:
Gradle: Configure Project
or
Gradle: Resolve Dependencies ':classpath:'
I went out to lunch and when I came back I saw:
Error:Could not HEAD 'http://jcenter.bintray.com/com/android/tools/build/builder-model/0.12.1/builder-model-0.12.1.jar'. Received status code 500 from server: Internal Server Error
Enable Gradle 'offline mode' and sync project
Bintray has experienced momentary timeouts yesterday due to a change to one of the cluster nodes in Dallas.
It looks like you've happened to hit that exact node at that exact time.
The issue has been sorted out after a couple of minutes, so there is no real need to change anything on your side.
Actually, keeping jcenter() in your script is preferable since it's a super-set of Maven Central.
In order to solve it, I went to File -> Project Structure -> Project and changed:
Android Plugin Repository and Default Plugin Repository from their default values of
jCenter()
to
mavenCentral
I had a similar problem and was able to use both repositories by including them both in my build.gradle in my android directory:
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
This is an adjustment to #MHDante's answer - instead of replacing one with the other, you can use both!
I was heaving the same/similar problem:
Error:A problem occurred configuring root project 'X'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:0.12.+.
Required by:
:X:unspecified
Failed to list versions for com.android.tools.build:gradle.
Could not list versions using M2 pattern 'http://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-revision.[ext]'.
Could not GET 'http://jcenter.bintray.com/com/android/tools/build/gradle/'. Received status code 401 from server: Authorization Required
But I resolved it by calling synchroise and then rebuilding the project.
I've made some waste code. After some mistakes I checkout latest commit. I expected to restart with any without any hitch. But building project now I receive the message:
Waiting for device.
Target device: samsung-gt_i8190n-47900693715f5036
Uploading file
local path: /Path/to/file.apk
remote path: /path/to/file/com.example
Local path doesn't exist.
(* I've removed complete local and remote path in this post ...)
Thus, when I try to sync project with gradle files, a new message from editor arrives:
Failed to refresh Gradle project 'NutriMondoProject'
Project is using an old version of the Android Gradle plug-in.
The minimum supported version is 0.7.0.
Please update the version of the dependency 'com.android.tools.build:gradle'
in your build.gradle files.
Search in build.gradle files
I feel like a fish out of water.
You have updated to Android Studio 0.4.0
it requires gradle plugin 0.7.+ and gradle-wrapper 1.9.
Change your build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
Then change your gradle-wrapper.properties:
distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
Then sync your project with gradle files.
Launch gradlew clean to clean your build.
It's because you updated your Android Studio to version 0.4.0.
Follow those steps to make it work :
http://tools.android.com/recent/androidstudio040released