Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio is giving the following error when I am trying to build a ionic project "Gradle sync failed: Sync failed: reason unknown"

I am trying to build a ionic project in Android studio on Ubuntu 20.04 . I am using the command ionic capacitor build then android studio opens up as expected then it shows this error Gradle sync failed: Sync failed: reason unknown. I am unable find a solution for this particular gradle sync error. I have reinstalled Ubuntu and other things but still the problem persists.

like image 392
Pritam Roy Avatar asked Nov 07 '22 01:11

Pritam Roy


1 Answers

In my case, a fresh install of Android Studio resulted in Android 31 being the only SDK available but the project was targeting Android 30. I went to Tools > SDK Manager and made sure the appropriate version of Android SDK was installed and available. After restarting, and allowing the gradle sync to complete I was able to build/run the app on a virtual device, etc.

like image 178
ajcurtis Avatar answered Nov 11 '22 13:11

ajcurtis