android-studiocordovabuild.gradle

Unable to determine Android SDK


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.