Error: Access is denied
I have recently installed Android Studio and I am running it from behind my organisation proxy. I have gone through 100 of links for this problem and I am not able to find the solution.
What I have done till now :
In gradle.properties I have written following lines
systemProp.http.proxyHost=sy*********om
systemProp.http.proxyPort=80
systemProp.http.proxyUser=RAGU
systemProp.http.proxyPassword=W********
systemProp.http.auth.ntlm.domain=*****om
systemProp.https.proxyHost=sy**********om
systemProp.https.proxyPort=80
systemProp.https.proxyUser=RAGU
systemProp.https.proxyPassword=W********
systemProp.https.auth.ntlm.domain=*****om
In Project Structure in JDK location I have entered the location of my jdk ie. C:\Program Files\Java\jdk1.8.0_66 instead of using the embedded JDK.
My build.gradle :
// 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:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My logs
you can see the logs via this link : https://drive.google.com/open?id=0B7ZLoWnEHDkac2thbXRTNEduTkZPSkFYNW56UVV3UzhmZ3NZ
Whenever I try to sync the gradle this error pops up . What can I do to resolve this error.
I had very ugly issues with gradle wrapper and gradle-wrapper.properties until i found this Gradle proxy configuration. I tested it and it worked like a sharm.The command was this
gradle -Dhttp.proxyHost=proxy -Dhttp.proxyPort=3128 -Dhttp.proxyUser=username -Dhttp.proxyPassword=password -Dhttps.proxyHost=proxy -Dhttps.proxyPort=3128 -Dhttps.proxyUser=username -Dhttps.proxyPassword=password wrapper
I ran it in the Android Studio terminal with Windows proxy disable.My PC is running on Windows 10 x64 VersiĆ³n 10.0.16299.15 with Android Studio 3.0.1
I hope this help you out there.Happy new year!!
Related
Similar question: Android studio gradle stuck at Fastutil.7.2.0.jar
When I'm building my first Android App in Java, Android Studio 4.0 is always complaining:
Could not GET 'https://jcenter.bintray.com/it/unimi/dsi/fastutil/7.2.0/fastutil-7.2.0.jar'. Received status code 400 from server: Bad Request
Enable Gradle 'offline mode' and sync project
However, it's possible to download the jar with the browser.
If I remove jcenter()in build.gradle, a similar error occurs:
Could not HEAD 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.72/kotlin-stdlib-jdk8-1.3.72.pom'. Received status code 400 from server: Bad Request
Enable Gradle 'offline mode' and sync project
This file doesn't even exist.
I tried modifying build.gradle or setting up proxy, but neither works.
gradle.build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
UPDATE:
Solved. Proxy's fault. Check C:\Users\USERNAME\.gradle\gradle.properties.
Make sure you have installed Command line tools
if not install from
sdk manager > sdk tools > check command line tools and apply
Using the latest Android Studio 3.0 Canary 5
Here's the error:
Error:(1, 1) A problem occurred evaluating project ':app'.
Failed to apply plugin [class 'com.android.build.gradle.api.AndroidBasePlugin']
Android Gradle plugin 3.0.0-alpha5 must not be applied to project [path_to_my_project] since version 3.0.0-alpha5 was already applied to this project
Tried: cleaning, rebuilding, opening/closing. Not working.
any ideas ?
[LATER EDIT]
Solution: Migrate to Canary 8+ and all should be ok.
From this reddit thread, killing daemons fixed the problem for me.
./gradlew --stop
This worked for me:
Deactivate Configuration On Demand
In gradle.properties:
org.gradle.configureondemand=false
Then stop the daemon in a terminal window:
gradlew.bat --stop
Now everything works again.
Versions used:
Android Studio 3.0 Canary 5
gradle: gradle-4.1-milestone-1
android gradle plugin: com.android.tools.build:gradle:3.0.0-alpha5
UPDATE
After upgrading to Android Studio 3.0 Beta 2 I can reactivate Configuration on Demand and everything works fine.
Migrating the gradle version from 3.0.0-alpha5 to 3.0.0-alpha7 saved my day !!
I got the issue and realized the issue related with caches.
You have to invalidate caches of Android studio by select File-> Invalidate Caches/Restart.
It worked for me. The issue was resolved.
Open a terminal and write
./gradlew --stop
In gradle.properties make sure you don't have funny stuff
Notice that there are no custom jvmargs...
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=false
Include the google() repo in build.gradle (project one)
there's how mine look like
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
maven { url "http://objectbox.net/beta-repo/" }
}
dependencies {
classpath 'io.objectbox:objectbox-gradle-plugin:0.9.12.1'
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://jitpack.io' }
jcenter()
google()
maven { url "http://objectbox.net/beta-repo/" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
lastly the support library versions in the app build.gradle file
build.gradle
...
//----- Support Libs
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
implementation "com.android.support:design:26.0.0-beta2"
implementation "com.android.support:recyclerview-v7:26.0.0-beta2"
implementation "com.android.support:cardview-v7:26.0.0-beta2"
...
I had the same issue, I closed Android Studio and opened again, I noticed that it automatically applied these changes to the following files and everything worked fine:
build.gradle: changed the class path of Gradle from:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha5'
}
gradle-wrapper.properties: from
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
I already tried all the solutions including
Clean,
Rebuild,
Invalidate Project
But nothing is working but i figured it out.
For temporary just downgrade your gradle plugin version to stable version
classpath 'com.android.tools.build:gradle:2.3.2'
Replace your alpha line with this line. And have fun.. :)
I download android studio 2.2.3 and load my project. But Gradle Build Running Stuck. It continuously shows that and i am not able to run my app. what is the issue can any one help me with that?
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If you are behind a proxy, create a gradle.properties file next to your build.gradle file with this :
systemProp.http.proxyHost=YOUR_PROXY
systemProp.http.proxyPort=YOUR_PORT
systemProp.http.proxyUser=USERNAME
systemProp.http.proxyPassword=PASSWORD
systemProp.https.proxyHost=YOUR_PROXY
systemProp.https.proxyPort=YOUR_PORT
systemProp.https.proxyUser=USERNAME
systemProp.https.proxyPassword=PASSWORD
systemProp.http[s].proxyUser and systemProp.http[s].proxyPassword are not required if you don't need to login for your proxy. In such a case, remove these lines.
Make sure you have a internet connection.
If you have it , so maybe android studio couldn't download classes from Jcenter. So you have to force android studio to download classes from other resource like Maven.
To do that open gradle.build file and change the two jcenter() text with mavenCentral() ("C" in maven"C"entral() must be typed in uppercase) and try syncing with gradle again.
You don't need to do that every time you open your project. Just do this every time you create a new project in Android studio.
Solutions:
1. update your Build tools.
2. Reinstall sdk.
In my case, all the executable ".exe" files in "sdk\build-tools\25.0.3" folder were corrupted by virus. solution 2 worked for my perfectly. :)
I've just pulled down an Android project from git, and Android Studio is giving me the following error whenever I attempt to open it;
Error:Could not find com.android.tools.build:gradle:2.2.0-alpha6.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.jar
https://maven.fabric.io/public/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.pom
https://maven.fabric.io/public/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.jar
Required by:
newApp_Android:app:unspecified
I've installed Gradle locally, and set up environment paths via System.
Under Project Structure/Project, the following setup is in use;
Gradle Version : 2.10
Android Plugin Version : 2.2.0-alpha6
Android Plugin Repository : jcenter
Default Library Repository : jcenter
Could anyone point me in the right direction on this?
This is because the build process is unable to find the dependency in Maven repository. Add jcenter() along with mavenCentral() in your project level build.gradle file.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
So I had a similar error while I was trying to build ionic2 project for android. This happened after android studio updated gradle during its updates.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugApk'.
A problem occurred configuring project ':CordovaLib'.
Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
Could not find com.android.tools.build:gradle:2.2.3.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
Required by:
android:CordovaLib:unspecified
I read the above answers which pointed to update a 'build.gradle' file but turns out there were multiple files with that name in the project. What worked for me (and hopefully helpful to whoever is working on angular2/ionic2 project and having this issue) is updating the build.gradle file at
[rootOfPorject]/platforms/android/CordovaLib/build.gradle
This file was missing the jcenter() entry and now the repository part looks like this and works like a charm.
repositories {
jcenter()
mavenCentral()
}
Hope this saves time for someone else.
EDIT: As #rcerecedar mentioned, you might also need to add jcenter() in the following file as well.
[rootOfPorject]/platforms/android/build.gradle
In this file you should check its present in buildscript -> repositories and also optionally in allprojects -> repositories
1.Goto "C:\Program Files\Android\Android Studio\gradle\m2repository\com\android\tools\build\gradle"
2.See the Latest folder name , i.e "2.2.3" , Copy It.
3.Go to build.gradle(Module:yourapp) file ,
Place here:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
If you have firewall configured in your PC,try the following in gradle.properties.
systemProp.https.proxyHost=<proxyHostName>
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=<user id>
systemProp.https.proxyPassword=<password>
systemProp.https.nonProxyHosts=www.google.com|localhost
What worked for me was i did exactly what "geekydhaval" said, thanks again for that but I went back to the dependencies {
classpath 'com.android.tools.build:gradle:2.3.0' } and change from 2.3.2 to 2.3.0 and the build completed successfully.
Replace the gradle:2.2.0-alpha6 to gradle:2.2.0-alpha3.
If this doesn't work replace it to gradle:2.2.0-alpha2.
As gradle is updating the previous version will be replaced with new version so we have to change the gradle version in code as it would be referring to previous version and will show error like this
Could not resolve all dependencies for configuration ':classpath'.
Could not find com.android.tools.build:gradle:2.2.3.
Searched in the following locations:
file:/home/ubuntu/.m2/repository/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
file:/home/ubuntu/.m2/repository/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
Required by:
:: Open file
The solution to this is that we add the repository in the build.gradle file
like
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
OR
GOTO the File Explorer and search
C:\Program Files\Android\Android Studio\gradle\m2repository\com\android\tools\build\gradle
and see the Gradle name with latest version like
Gradle 2.2.0
Gradle 3.2.1
Gradle 2.1.0
and select the latest version like 3.2.1 and paste it in the build.gradle file in dependencies section like
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'}
I'm trying to import a project from GitHub and build/run it on Android Studio. I am getting the following error:
"Error:Could not create an instance of Tooling API implementation
using the specified Gradle distribution
'https://services.gradle.org/distributions/gradle-2.4-all.zip'."
I have tried the following:
Invalidate Cache and Restart
Changing the distributionURL in gradle-wrapper/properties to 2.5 etc.
Deleting build.gradle and restarting
These are ideas I got from several other posts on stackoverflow so I cannot explain why I tried these. (I'm very fairly new to Android Studio).
My build.gradle file looks like this:
// 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.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
} }
allprojects {
repositories {
jcenter()
} }
task clean(type: Delete) {
delete rootProject.buildDir }
I was facing a similar issue, updating the Gradle version in distributionUrl solved it.
distributionUrl field is present under this directory:
project-root-directory/gradle/wrapper/gradle-wrapper.properties
Please, change
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
with
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Then change
classpath 'com.android.tools.build:gradle:1.5.1'
with
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
It should work.
For me I think it is permission issue. From Eclipse I have also faced the same issue. On my gradle installation path (i.e. /opt/gradle) I have make it chmod as 777. So that other tool can access the same. Run the following 2 commands -
cd /opt
sudo chmod 777 -R gradle
Java versions > 9 and Gradle versions >= 5.0.0 has some code breaking changes. Here is to go around them using Eclipse. It should be similar in AndroidStudio.
Install the latest version of gradle from its distribution site
("https://services.gradle.org/distributions/") and
unzip the it on your PC.
When importing the gradle project in eclipse select the option "local installation
directory" and point to the folder where you unzip gradle.
(Bonus) if it is a LibGDX project, you need to also change the following in the Desktop
build file due to code breaking changes between gradle versions <5.0.0 and >=5.0.0.
Change "sourceSets.main.output.classesDir" to "sourceSets.main.output.classesDirs".
This is working for me and I am using LibGDX with Java 11 and Gradle 5.2.1 on Windows 10 while running Eclipse 2018-12.
Try deleting the folder gradle-2.4-all in ~/.gradle/wrapper/dists