Unable to determine Android SDK

Issue

Cordova creates a package and imports it to android studio

Following Error:

1: Task failed with an exception.
-----------
* Where:
Script '/Users/admin/Projects/android_App/Android_1/platforms/android/CordovaLib/cordova.gradle' line: 112

* What went wrong:
A problem occurred evaluating project ': app'.
> Unable to determine Android SDK directory.

* Try:
Run with --stack trace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ': app'.
> compileSdkVersion is not specified. Please add it to build.gradle`

There is no plugin.
I have updated all Cordova, npm, android studio with the latest one. But still not able to solve this issue.

SDK tools uninstall and install again.

Solution

Finally, I found the solution.
Its a Corova package issue. By default under android local.properties file will be creating while adding cordova platform android. Now that file is not adding.

Create new file –> Project–> Platform –> android–> local.properties

and keep this –> sdk.dir=/path/sdk example [sdk.dir=/Users/admin/Library/Android/sdk]

then it starts working.

Thanks.

Answered By – sarathi

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published