7

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 
Matheus Tsa
  • 81
  • 1
  • 1
  • 7

4 Answers4

5

try File -> Invalidate Caches/Restart

enter image description here

yathavan
  • 2,051
  • 2
  • 18
  • 25
2

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)
vovahost
  • 34,185
  • 17
  • 113
  • 116
  • Can you help me in that? I am using AS with flutter and dart and kotlin/java native projects. But I disabled the plugin and the newly created projects are showing this error too... – lacas Apr 14 '20 at 12:20
  • @lacas Try updating Android Studio, Flutter plugin and Dart plugin. Also update Flutter to the latest version using `flutter upgrade`. Also Update Gradle and Gradle plugin https://stackoverflow.com/questions/17727645/how-to-update-gradle-in-android-studio – vovahost Apr 14 '20 at 15:31
  • @lacas I would also suggest you execute `File > Invalidate caches` in Android Studio after you've done all the above actions. – vovahost Apr 14 '20 at 15:37
1

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.

Ashok
  • 3,190
  • 15
  • 31
-1

Finally found the solution!!!!

I was working with two projects, one in Kotlin and one in Flutter. First of all, there was some conflict with the plugins, so in order not to have to be disabling/enabling them every time I swap projects, I chose to have two separate installations of android studio, one for each project.

Then, after some manifest errors, this answer, combined with this video saved my day.

Hope, it helps others too.

Matheus Tsa
  • 81
  • 1
  • 1
  • 7