JaskeyLam
JaskeyLam

Reputation: 15755

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

I am new to Android Studio and I have just created a new project with only one Activity with fragments(Android studio created that), and when I ran the MyActivity.java , error occurs:

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

Nothing more in my event log.

I have no idea why it is, and This link did not helps.

One clue is that Gradle project sync in progress is flowing all the time , just after I restart the Studio.

Upvotes: 16

Views: 24740

Answers (2)

nelion
nelion

Reputation: 1962

The exact same error message also pops up if there is a syntax-error inside your AndroidManifest.xml file. So if the above won't work - which it didn't for me - then check the AndroidManifest.xml syntax. That will save you thousands of frustrating hours.

Upvotes: 0

shikhar bansal
shikhar bansal

Reputation: 1679

  1. Goto File -> Invalidate caches / Restart
  2. Shutdown Android Studio
  3. Rename/remove .gradle folder in the user home directory
  4. Restart Android Studio (It will download gradle metadata and data)
  5. Gradle build succeed
  6. Rebuild project
  7. Done

Upvotes: 8

Related Questions