Requirements check results for android: Java JDK: installed 1.8.0 Android SDK: not installed Failed to find 'ANDROID_HOME' environment variable. Try setting it manually. Detected 'adb' command at C:\Windows\system32 but no 'platform-tools' directory found near. Try reinstall Android SDK or update your PATH to include valid path to SDK\platform-tools directory. Android target: not installed android: Command failed with exit code ENOENT Error output: 'android' �����ڲ����ⲿ���Ҳ���ǿ����еij��� ���������ļ��� Gradle: not installed Could not find gradle wrapper within Android SDK. Could not find Android SDK directory. Might need to install Android SDK or set up 'ANDROID_HOME' env variable.
Requirements check results for browser:
Requirements check results for ios: Apple macOS: not installed Cordova tooling for iOS requires Apple macOS Some of requirements check failed
可以看到,我的电脑环境并不满足android和ios平台的要求。
首先我们来满足下android平台的环境要求。
JDK
首先是JDK,可以通过java和javac命令来检查下。
1 2 3 4
C:\>java -version java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
$ cordova run android Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=C:\Users\Jiang.Wenbin\AppData\Local\Android\Sdk (DEPRECATED) Starting a Gradle Daemon (subsequent builds will be faster)
于是我又新增了一项系统变量ANDROID_SDK_ROOT,变量值与ANDROID_HOME一样。
重新跑cordova run android命令,首先看到警告如下:
1 2 3
> Configure project :app Checking the license for package Android SDK Platform 28 in C:\Users\Jiang.Wenbin\AppData\Local\Android\Sdk\licenses Warning: License for package Android SDK Platform 28 not accepted.
No target specified and no devices found, deploying to emulator No emulator images (avds) found. 1. Download desired System Image by running: "C:\Users\Jiang.Wenbin\AppData\Local\Android\Sdk\tools\android.bat" sdk 2. Create an AVD by running: "C:\Users\Jiang.Wenbin\AppData\Local\Android\Sdk\tools\android.bat" avd HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver