Olá pessoal.
Estou tentando executar o comando "cordova run android" e exibe o erro abaixo. Já desinstalei todas as versões anteriores do Java e instalei o jdk 10. O que pode ser?
C:\garconapp>cordova run android
Android Studio project detected
ANDROID_HOME=C:\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk-10
(node:2292) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: Requirements check failed for JDK 1.8 or greater
(node:2292) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Edit]
Desinstalei o Android Studio, Android SDK e Java SDK 10. Instalei o Java SDK 8 e reinstalei o Android Studio e Android SDK. Então após executar o comando "cordova run android" ele pediu para instalar o Gradle. Instalei o gradle e setei as variáveis de ambiente. Agora pede para criar um emulador no Android SDK.
BUILD SUCCESSFUL in 40s
47 actionable tasks: 47 executed
Built the following apk(s):
C:\garconapp\platforms\android\app\build\outputs\apk\debug\app-debug.apk
ANDROID_HOME=C:\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161
No target specified and no devices found, deploying to emulator
(node:816) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): CordovaError: No emulator images (avds) found.
1. Download desired System Image by running: "C:\android-sdk\tools\android.bat" sdk
2. Create an AVD by running: "C:\android-sdk\tools\android.bat" avd
HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver
(node:816) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Vou instalar o que está pedindo na mensagem, depois eu posto aqui se funcionou.
[Edit 2]
O comando "cordova run android" continuou não funcionando mesmo eu criando uma AVD, talvez esteja faltando alguma coisa. Testei com o comando "cordova run android --device" e funcionou no meu smartphone.