无法确定AndroidSDK

Cordova 创建一个包并导入到android studio

以下错误:

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`

没有插件。我已经用最新的版本更新了所有 Cordova、npm、android studio。但是仍然无法解决这个问题。

SDK 工具卸载并重新安装。

回答

最后,我找到了解决方案。它是一个 Corova 包问题。默认情况下,在添加cordova 平台android 时,将在android 下创建local.properties 文件。现在该文件没有添加。

创建新文件--> 项目--> 平台--> android--> local.properties

并保留此 --> sdk.dir=/path/sdk 示例 [ sdk.dir=/Users/admin/Library/Android/sdk ]

然后它开始工作。

谢谢。

  • Can't vote this up enough! I've been going around in circles on this issue.

以上是无法确定AndroidSDK的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>