Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle sync failed after update

Tags:

android

gradle

Android Studio asked me to upgrade the gradle to version 3.5.1, but once I do it it simply doesn't sync anymore, though I don't report any apparent bugs ...

The only error message that appears says "Gradle project sync failed. Basic functionality (eg editing, debugging) will not work properly."

22:32 Gradle sync failed: org / jetbrains / plugins / gradle / util / GradleConstants Consult IDE log for more details (Help | Show Log) (18 s 224 ms)

Already tried to clean the project, rebuild, and invalidate / restart, but nothing worked

Can someone help me?


My build script:

buildscript {
    ext.kotlin_version = '1.3.50'
    ext.anko_version='0.10.8'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // 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
}

And some of my "idea.log" last entries

2019-10-03 22:32:41,266 [e-1483-b03]   INFO - rationStore.ComponentStoreImpl - Saving Project 'C:\Users\mathe\Pictures\Design\ANDROID\ResistCalc' ResistCalcProjectCodeStyleConfiguration took 40 ms 
2019-10-03 22:32:41,266 [Alarm Pool]   INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 163 ms 
2019-10-03 22:32:46,056 [e-1483-b03]   WARN - un.AndroidRunConfigurationBase - Can't get application ID: Android module missing 
2019-10-03 22:32:46,056 [e-1483-b03]   WARN - un.AndroidRunConfigurationBase - Can't get application ID: Android module missing 
2019-10-03 22:32:46,056 [e-1483-b03]   WARN - un.AndroidRunConfigurationBase - Can't get application ID: Android module missing 
2019-10-03 22:32:46,056 [e-1483-b03]   WARN - un.AndroidRunConfigurationBase - Can't get application ID: Android module missing 
like image 786
Matheus Tsa Avatar asked Oct 04 '19 05:10

Matheus Tsa


People also ask

Why is gradle sync failing?

Missing Files: There is a chance of Gradle files getting misplaced. This can be solved by re-installing the required files. Using the Proxy Servers: There was an issue with the syncing of the Gradle when Proxy Servers were turned on. Disabling it can help.

Why is Gradle build failing?

When Gradle is unable to communicate with the Gradle daemon process, the build will immediately fail with a message similar to this: $ gradle help Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details FAILURE: Build failed with an exception.


3 Answers

try File -> Invalidate Caches/Restart

enter image description here

like image 195
yathavan Avatar answered Oct 16 '22 23:10

yathavan


In my case it was caused by the Flutter Plugin. Just disable the Flutter Plugin and the sync should work again. This is the error from the logs:

2019-10-04 11:33:32,903 [thread 284]   WARN - nal.AbstractExternalSystemTask - org/jetbrains/plugins/gradle/util/GradleConstants 
java.lang.NoClassDefFoundError: org/jetbrains/plugins/gradle/util/GradleConstants
    at io.flutter.utils.FlutterExternalSystemTaskNotificationListener.onSuccess(FlutterExternalSystemTaskNotificationListener.java:17)
    at com.intellij.openapi.externalSystem.service.remote.ExternalSystemProgressNotificationManagerImpl.onSuccess(ExternalSystemProgressNotificationManagerImpl.java:113)
    at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:118)
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:165)
    at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:151)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.executeImpl(ExternalSystemUtil.java:563)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.lambda$execute$0(ExternalSystemUtil.java:399)
    at com.intellij.openapi.project.DumbServiceImpl.suspendIndexingAndRun(DumbServiceImpl.java:146)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:399)
    at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:668)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:731)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:586)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:86)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
    at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:403)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:312)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
like image 33
vovahost Avatar answered Oct 16 '22 21:10

vovahost


This problem occurs when the Build Tools Version is not set for the project. You just need to set the build tools version

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.

like image 34
Ashok Avatar answered Oct 16 '22 23:10

Ashok