skip to Main Content

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

Failed to find Platform SDK with path: platforms;android-31

  • 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.

BUILD FAILED in 4m 1s
Exception: Gradle task assembleDebug failed with exit code 1

I WAS RUNNING MY CODE ON THE EMULATOR AND THEN THE BUILD FAILED

2

Answers


  1. When you’ve specified a version XX of compileSdkVersion (file that you can find under ../adroid/app/build.gradle) that version XX must be present on the machine which compile your project (in your case your PC).

    You can download that version by SDK Manager on Tab "SDK Tools" (tick the exact version you’ve specified in your build.gradle file)

    Image below may call your memory of IDE usage :).

    enter image description here

    Login or Signup to reply.
  2. Hello Elimimian Osemaoje,

    Please follow the following steps.

    Step 1: Open Preferences or Settings in Android studio. Select Android SDK options and Install Android API 31 as selected below.

    https://prnt.sc/TCjn0jTfgsIY

    There’s a problem with CompileSdkVersion as you have to change it from ‘android-P’ to 31.

    compileSdkVersion 31 And Build project. That’s it.

    Hope this helps!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search