Android: how to Fix Gradle execution error? - android

I have Android Studio installed on my PC and it has been working fine. I just opened up Android Studio (v2.3.2) and now my projects won't build/sync.
Error message says Gradle project sync failed. Failed to complete
Gradle execution. Cause: CreateProcess error=2, The system cannot
find the file specified.
Not sure if this has anything to do with it, but the error occurred after I loaded a Samsung USB Driver onto my computer so that I can connect my Samsung device to Android Studio for testing my projects. Any ideas how to get back up and running again?
Here is additional error message:
Error: Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.html
Please read the following process output to find out more:
Error: could not open `C:\Program Files\Java\jre1.8.0_131\lib\amd64\jvm.cfg'
And the setting in Android Studio for File \ Other Settings \ Default Project Structure \ JDK location: is set to "Use embedded JDK" which is at: C:\Program Files\Android\Android Studio\jre".
Gradle info.:
build.gradle (Project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module: app)
defaultConfig {
applicationId "com.example.jdw.v060B"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
}

Have you check your gradle-wrapper.properties, check there distribution url must be greater than 3.0 or you use this
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

Related

gradle sync failed, read timeout error in android studio 3.3.1 for sample hello world app in

connection timeout error in gradle sync, in android studio 3.3 for sample hello world app in.
Earlier it was working with no proxy set in http setting in android studio settings.
I have tried other solution from stack overflow. looks like gradle can't download from all urls.
now reinstalling studio after completely uninstalling it.
Update
after reinstalling the problem persists.
SOMETIME build clean from GUI does not do anything at all.
Project level Build.gradle file
** Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
**
App level build.graldle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Update
After formatting my windows 10 and freshly installed development tools, it now throws Gradle Sync Failed: Read timeout error
Its Network issue fails to build pass offline argument in Gradle
Try ./gradlew tasks --offline
For run Android project in offline mode visit GRADLE CLI docs : Gradle
Android Studio
In Android, studio can make Gradle to build your project in offline mode options :
Settings -- Build, Execution, Deployment -- Build tools -- Gradle
Gradle Offline Android
Solution: that worked for me
setting -
language and framework -
kotlin -
update kotlin plugin version -
restart computer -
run android studio and now it works and it ran faster
tried
using local gradle repository
changing no proxy in setting-http
uninstalling, reinstalling, formatting my laptop
after 2 days:
i tried to see a kotlin in setting. then there was an update for kotlin,

Android Studio Gradle Sync Error using google play-services-maps 11.6.2

I am developing a google map app using Android Studio. When I sync the project with Gradle Files (Select Tools/Android/Sync Project with Gradle Files on Android Studio), I get the following error:
Could not resolve com.google.android.gms:play-services-maps:11.6.2.
Couold not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-maps/11.62./play-services-maps-11.6.2.pom
This is the software I am using:
Android Studio 3.0.1
Android Version 7.1.1
Google Play Services 46
Google Repository 58 (under Support Repository)
I've tried using both the google maps project template and the empty activity project but I get the same error.
I am using the http proxy setup I used from earlier projects. I am able to install the play-services-maps and the google repository.
I also added the maven url to the Gradle Project file in the All Projects/Repositories section.
I have tried the suggestions from Stack Overflow but none have not worked.
Any ideas?
Gradle Project 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:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The gradle app build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "hansen.scott.googlemaps"
minSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-maps:11.6.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
The error is in the line:
implementation 'com.google.android.gms:play-services-maps:11.6.2'
try adding this in project level gradle file
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
}
}
Someone had the same issue I did and entered it on Stack Overflow a day or two ago. The user was getting a build error when using player-services-maps 11.6.2. If the user changed the version to 11.0.0, the build succeeded.
Once I back-dated the maps version to 11.0.0, this solved my problem too. I created a new Google Map project and didn't modify the Gradle Build files.
The problem appears to be that play-services-maps won't build using a versions after 11.0.0. I will post the issue on Github.
Thank you for everybody's help.
I have been facing the same issue for the past one week and posted it on Stack Overflow as well but to no effect.
I have since then figured out the root cause. I am working out of my office and thus have firewalls in place. I got it checked with the system admin and on turning off the firewall the build worked.
So i would advice you to have this checked as well.
Kind regards,
Kabir

Gradle Connection timed out

after updating android studio 2.3 to 3.0 i got lots of errors so many work i done it but didn't work
Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
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.
Could not resolve com.android.support:appcompat-v7:26.1.0.
Could not get resource 'https://jcenter.bintray.com/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom'.
Could not HEAD 'https://jcenter.bintray.com/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom'.
Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out: connect
gradle wrapper properties
#Mon Nov 06 17:20:27 IRST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
my gradle (module app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "curlpagetutorial.example.com.mydd"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
gradle
// 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:3.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
}
New errors
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.
Could not resolve com.android.support:appcompat-v7:26.1.0.
Could not resolve com.android.support.test:runner:1.0.1.
Could not resolve com.android.support.test.espresso:espresso-core:3.0.1.
I'm stuck here for long time please help me
Ihave had the same problem.
Finally I fixed it ussing an external gradle instalation. To make it you need to configure File->Settings->Build,Execution and deployments->Gradle
Check -> Use local gradle distribution
Select gradle home instalation.
If you are using an corporative connection, you also have to configure gradle proxy properties configuring or creating file gradle.properties in folder "/Users/user/.gradle":
#http proxy setup
systemProp.http.proxyHost=url
systemProp.http.proxyPort=port
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
#https proxy setup
systemProp.https.proxyHost=url
systemProp.https.proxyPort=port
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
That's all!
Download gradle from:http://services.gradle.org/distributions/
choose the file such as gradle-4.1-rc-1-all.zip
Find your gradle directory in AndroidStudio
setting-->Build,Execution,Deployment -->Gradle
Unzip the file to "(your gradle path)\wrapper\dists\gradle-4.1-all\bzyivzo6n839fup2jbap0tjew"

How to fix dependency issues in AndroidStudio?

I just clones an android project from my local repo and I have trouble to 'build' it. Maybe it missed some external library, but I do not know.
Upon starting a grade build I get the following message:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> Configuration with name 'default' not found.
I tried to check the 'Manifest' file, but I can't find it. I am completely lost...
I am pretty sure this is a configuration error, therefore all the config files I can find here:
build.gradle (project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.impyiablue.myapp"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.firebase:firebase-ads:9.0.0'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile project(path: ':LibraryModule')
}
apply plugin: 'com.google.gms.google-services'
cradle-wrapper.properties
#Wed Sep 07 20:03:05 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
settings.gradle:
include ':app'
include ':libraries:volley'
include ':LibraryModule'
project(':LibraryModule').projectDir = new File('/Users/adietz/AndroidStudioProjects/LIBS')
local.properties:
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sun Oct 15 11:07:25 CEST 2017
sdk.dir=/Users/adietz/Library/Android/sdk
The output of ./gradlew build (from inside the project folder) is the following:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/Users/adietz/.gradle/wrapper/dists/gradle-2.14.1-all/4cj8p00t3e5ni9e8iofg8ghvk7/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.217 secs
Part of the solution seems to be a change in the file build.gradle (for Module:app). If you replace this line
compile project(path: ':LibraryModule')
with this line:
compile project(':libraries:volley')
and do 'Clean Project again', different things might happen:
AndroidStudio start to download stuff
Other gradle files appear mysteriously in your Gradle Scripts folder
Other errors appear (which you can google and actually find some helpful answers)
But it might fix the actual problem...

Android Studio 1.3 will not work with jcenter() Android Repository

Project build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "com.example.mark.god_dam_supportlib"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v21:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
}
tried:
Putting the URL for bintray in the jcenter()
.
Disable offline mode
Made sure jcenter was in Project Structure - > Project - > [Android Plugin Repository && Default Library Repository].
Toggled disable offline mode.
Removed and reinstalled Android Support Repository,
Android Support Library (many times).
No network proxy.
Set the .gradle to 777.
No Matter what get on a gradle sync:
Error:(25, 13) Failed to resolve: com.android.support:appcompat-v21:22.2.1
Install Repository and sync projectShow in FileShow in Project Structure dialog
Click on “ Install Repository and sync project”
Error message in the “Install Missing Components” dialog:
Loading SDK information...
Ignoring unknown package filter 'extra-android-m2repository'Warning: The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
As well in red at the bottom of “Install Missing Components” dialog”
Imstailed Failed: Please check your network conection and try again. You may continue creating your project, but it will not compile correctly without the missing components
On a Gradle build get:
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.android.support:appcompat-v21:22.2.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v21/22.2.1/appcompat-v21-22.2.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v21/22.2.1/appcompat-v21-22.2.1.jar
file:/home/usr/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v21/22.2.1/appcompat-v21-22.2.1.pom
file:/home/usr/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v21/22.2.1/appcompat-v21-22.2.1.jar
file:/home/usr/Android/Sdk/extras/google/m2repository/com/android/support/appcompat-v21/22.2.1/appcompat-v21-22.2.1.pom
file:/home/usr/Android/Sdk/extras/google/m2repository/com/android/support/appcompat-v21/22.2.1/appcompat-v21-22.2.1.jar
Required by:
Name_ofApp_folder:app:unspecified
Checked Google, Stack Over Flow.
Box is an Ubuntu 14.04 LTS straight up desktop.
Went as far as trying to down load the Android Support Repository manually could find a download page.
As An Aside used these “ Android Support Repository” first quarter of the year with out any grief (need to update one!).
Completely and totally out of ideas and getting dangerously low on patience as well
Failed to resolve: com.android.support:appcompat-v21:22.2.1 Install Repository and sync project
That is because there is no artifact named com.android.support:appcompat-v21. It is called com.android.support:appcompat-v7, and you already have a compile statement for it. Delete the compile statement for com.android.support:appcompat-v21.
Note that none of this has anything to do with JCenter, despite your question title.

Categories

Resources