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.
- Get more help at https://help.gradle.org
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
When you’ve specified a version
XX
ofcompileSdkVersion
(file that you can find under../adroid/app/build.gradle
) that versionXX
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 :).
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!