Error running android: Gradle project sync failed. Please fix your project and try again

前端 未结 30 2973
南方客
南方客 2020-11-30 18:32

Android Studio (1.2 RC0) keeps telling me Error running android: Gradle project sync failed. Please fix your project and try again. How can I find out what th

相关标签:
30条回答
  • 2020-11-30 19:04

    this worked for me:

    Step 1: visit Release Notes page of Gradle plugin : https://developer.android.com/studio/releases/gradle-plugin

    Step 2: go to File > Project Structure > Project and make sure that your Gradle plugin version is compatible with Gradle by referring to table in link above

    0 讨论(0)
  • 2020-11-30 19:05

    It could be that you are using gradle in offline mode. To uncheck it go to File > Settings > Gradle, uncheck the Offline Work checkbox, and click Apply Make sure you have internet connection and sync the project again.

    0 讨论(0)
  • 2020-11-30 19:06
    1. Download the latest Gradle package distribution for example (gradle-2.11-all.zip).
    2. Extract this zip file in a folder as for example (D://Gradle)
    3. Load your project in Android Studio and go to File->Settings->Gradle. Click on Use local Gradle distribution and point it to the folder where you unzipped the latest Gradle project.
    4. Restart your project
    0 讨论(0)
  • 2020-11-30 19:07

    I got this error going from Gradle 3.5.3 to 5.4.1 (Android Studio prompted and I clicked "Upgrade".)

    Gradle proceeded to upgrade but yielded some errors such as:

    ONFIGURE SUCCESSFUL in 1m 27s
    ERROR: The Android Gradle plugin supports only Crashlytics Gradle plugin version 1.25.4 and higher.
    The following dependencies do not satisfy the required version:
    root project 'Android%20App' -> io.fabric.tools:gradle:1.25.1
    Update plugins
    Affected Modules: app
    
    INFO: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
    It will be removed at the end of 2019.
    For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
    To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
    Affected Modules: app
    
    INFO: The specified Android SDK Build Tools version (27.0.3) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.5.3.
    Android SDK Build Tools 28.0.3 will be used.
    To suppress this warning, remove "buildToolsVersion '27.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
    Install Build Tools 28.0.3, update version in build file and sync project
    Affected Modules: app
    
    

    The thing that fixed it was opening Settings --> Appearance & Behavior --> System Settings --> Android SDK and I then selected some recent versions of Android SDK like 8, 9, and 10. (I had only had 5.1, 6.0, and Android N Preview installed.)

    Once that's installed, I had to modify my build.gradle file for my Module: app

    • Removed buildToolsVersion '27.0.3'

    Then I clicked the "Sync Project with Gradle Files" button on the toolbar. The Sync output window offered an option to "Update Plugins" and once I clicked through that everything seemed to work. For good measure I again clicked "Sync Project with Gradle Files" followed by Build --> Clean Project, and finally I was able to run my project again.

    0 讨论(0)
  • 2020-11-30 19:09

    Solution is

    1. Connect your computer to the internet

    2. Click

    Sync project with Gradle files

    On toolbar enter image description here

    It will automatically sync the gradle.

    0 讨论(0)
  • 2020-11-30 19:10

    None of these answers worked for me, so I uninstalled Android Studio, and reinstalled it. (I did not delete settings) It now works perfectly.

    0 讨论(0)
提交回复
热议问题