How to solve error “FAILURE:Build failed with an exception” in android studio?

Error

FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ‘:app’. > Could not open cp_proj generic class cache for build file ‘C:\Users\dharm\AndroidStudioProjects\my_hospital_now\android\app\build.gradle’ (C:\Users\dharm.gradle\caches\7.2\scripts\b3h9kpbsn0ml2oi5s7go52cjs). > BUG! exception in phase ‘conversion’ in source unit ‘BuildScript‘ class org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to class org.codehaus.groovy.ast.expr.ArgumentListExpression (org.codehaus.groovy.ast.expr.TupleExpression and org.codehaus.groovy.ast.expr.ArgumentListExpression are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @6a4f787b) * Try: Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.

Solution

It seems that necessary Android 27 API’s are missing in your Android sdk directory. go to ~/library/android/sdk/tools/bin and run sdkmanager –list to check if you have platform-tools and platforms;android-27 installed. If not, then you can install them by running sdkmanager “platform-tools” “platforms;android-27”

If you have Android Studio, then you can install them via Android Studio’s GUI, too.

  • open file menu—> project structure—>project settings—>project
  • check your project SDK
  • also check >>>project structure—>platform settings—>sdks
  • give same SDK and click ok
  • try to run project

Try running this command:

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x