cordova要求问题,没有安装android目标

use*_*839 12 android cordova android-studio cordova-plugins

我正在尝试在Windows 7上安装Cordova.我正在关注本教程:https: //www.tutorialspoint.com/cordova/cordova_first_application.htm

当我运行cordova要求时,它表示没有安装android目标并设置ANDROID_HOME环境变量

I:\CordovaProject\hello>cordova requirements
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
Android SDK not found. Make sure that it is installed. If it is not at the 
default location, set the ANDROID_HOME environment variable.
Gradle: installed
Error: Some of requirements check failed

I:\CordovaProject\hello>echo %ANDROID_HOME%
C:\Users\user\AppData\Local\Android\sdk
Run Code Online (Sandbox Code Playgroud)

正如您在图像1中看到的那样,当我回显ANDROID_HOME时,它被设置为正确的位置.我无法解决此错误.请帮助我

路径包含:%ANDROID_HOME%\ tools;%ANDROID_HOME%\ platform-tools

我在android studio下载了android-25

和项目属性文件的android目标设置为:android-25在I:\ CordovaProject\hello\platforms\android\CordovaLib\project.properties
I:\ CordovaProject\hello\platforms\android\project.properties

当我运行cordova build android时,我得到以下错误

BUILD FAILED

Total time: 31.807 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
 > Could not resolve all dependencies for configuration ':classpath'.
 > Could not download uast.jar (com.android.tools.external.com-
 intellij:uast:145.597.3)
  > Could not get resource 'https://jcenter.bintray.com/com/android/tools/ex
 ternal/com-intellij/uast/145.597.3/uast-145.597.3.jar'.
     > Could not GET 'https://jcenter.bintray.com/com/android/tools/external
  /com-intellij/uast/145.597.3/uast-145.597.3.jar'.
        > akamai.bintray.com

  * Try:
   Run with --stacktrace option to get the stack trace. Run with --info or -
   -debug   option to get more log output.
Run Code Online (Sandbox Code Playgroud)

小智 7

我发现了同样的问题并修复了它!

其相关的Java路径JAVA_HOMEPath变量应包含与Android Studio(JRE文件夹)相同的路径。您可以在 Android Studio,SDK Location 中找到此信息。

更改我的PathJAVA_HOME变量后(转到控制面板、系统和安全、系统、环境变量)更新PathJAVA_HOME变量到C:\Program Files\Android\Android Studio\jre.

更多细节... JAVA_HOME包含C:\Program Files\Android\Android Studio\jrePath包含C:\Program Files\Android\Android Studio\jre\bin

检查要求都很好!

科尔多瓦要求


Eli*_*pes 5

For SDK 21 ("android-21")

$ cordova platform remove android
$ cordova platform add android@3.7.1
Run Code Online (Sandbox Code Playgroud)

对于SDK 22(Android 4.1.1,“ android-22”)

$ cordova platform remove android
$ cordova platform add android@4.1.1
Run Code Online (Sandbox Code Playgroud)


Shu*_*waj 2

您应该检查清单中指定的构建目标,然后使用 android-studio 中的 sdk 管理器交叉检查是否安装了相同的目标 sdk。

注意: 您应该寻找的行是:

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />
Run Code Online (Sandbox Code Playgroud)