Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Problema em executar o app no dispositivo (cordova run android --device)

quando dou o comando para executar o app, aparece a seguinte mensagem de erro:

"Android Studio project detected ANDROID_HOME=C:\Users\marce\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161 studio Subproject Path: CordovaLib Subproject Path: app publishNonDefault is deprecated and has no effect anymore. All variants are now published. Checking the license for package Android SDK Platform 26 in C:\Users\marce\AppData\Local\Android\sdk\licenses

FAILURE: Build failed with an exception. Warning: License for package Android SDK Platform 26 not accepted.

  • What went wrong: A problem occurred configuring project ':CordovaLib'.

    You have not accepted the license agreements of the following SDK components: [Android SDK Platform 26]. Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s (node:2640) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':CordovaLib'.

    You have not accepted the license agreements of the following SDK components: [Android SDK Platform 26]. Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s at ChildProcess.whenDone (C:\Users\marce\Desktop\garconapp\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at maybeClose (internal/child_process.js:925:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) (node:2640) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:2640) [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."

O que esta errado, e o que fazer para resolver?

2 respostas
solução!

Boa tarde Marcelo,

Primeira solução: Abra o Android Studio, baixe o Android SDK mais atual e aceite todas as licensas. Depois tente criar um projeto no android studio, é possível que ele te mostre uma tela para aceitar a licensa do SDK android 26 ou mais atual.

Se isso não resolver tente a segunda solução:

Navegue até:

C:\Users\xxx\AppData\Local\Android\Sdk\tools\bin

e rode :

./sdkmanager --licenses

Isso deve rodar o contrato de licensa no console.

Abraços

Mais sobre esse problema

Fiz a segunda opção, e agora esta funcionando normal.

obrigado.

abraços.