hello, i am trying to debug a simple app, i used the following commands
ionic cordova platform add android
ionic cordova build android
i get the following after the build command:
Android Studio project detected
ANDROID_HOME=C:\Users\h2001\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\java\jdk-10.0.2
(node:11980) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater
at C:\Users\h2001\Desktop\myApp\platforms\android\cordova\lib\check_reqs.js:370:19
at _fulfilled (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:11980) 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:11980) [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.
i do get a (platform/android) directory, but there is no apk file inside it, believe me, i checked !
what should i do now, can i somehow reboot ionic?
i have android home installed with all the updates, and java jdk
ionic info:
Gathering environment info - done!
Ionic:
ionic (Ionic CLI) : 4.0.6 (C:\Users\h2001\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.10
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0
System:
Android SDK Tools : 26.1.1
NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 6.3.0
OS : Windows 10
Environment:
ANDROID_HOME : C:\Users\h2001\AppData\Local\Android\Sdk
What is your ionic info output?
What is the complete output of your build command? The error message you posted is not an actual error message.
ionic info:
Gathering environment info - done!
Ionic:
ionic (Ionic CLI) : 4.0.6 (C:\Users\h2001\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.10
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0
System:
Android SDK Tools : 26.1.1
NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 6.3.0
OS : Windows 10
Environment:
ANDROID_HOME : C:\Users\h2001\AppData\Local\Android\Sdk
this is what shows up after build command:
Android Studio project detected
ANDROID_HOME=C:\Users\h2001\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\java\jdk-10.0.2
(node:11980) UnhandledPromiseRejectionWarning: CordovaError: Requirements check failed for JDK 1.8 or greater
at C:\Users\h2001\Desktop\myApp\platforms\android\cordova\lib\check_reqs.js:370:19
at _fulfilled (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:816:13)
at C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:624:44
at runSingle (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\h2001\Desktop\myApp\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:11980) 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:11980) [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.
UPDATE, as sujan12 suggested, the problem had to do with android inability to work with java10 so i downgraded to java8, however, this time i got the following error:
File C:\Users\h2001\.android\repositories.cfg could not be loaded.
Checking the license for package Android SDK Platform 26 in C:\Users\h2001\AppDa ta\Local\Android\Sdk\licenses
Warning: License for package Android SDK Platform 26 not accepted.
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 co mplete the installation of the missing components using the Android Studio SDK M anager.
Alternatively, to learn how to transfer the license agreements from one workst ation 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 14m 59s
(node:10380) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with e xit 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 co mplete the installation of the missing components using the Android Studio SDK M anager.
Alternatively, to learn how to transfer the license agreements from one workst ation 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 14m 59s
at ChildProcess.whenDone (C:\Users\h2001\Desktop\myApp\platforms\android\cor dova\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:10380) 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(). (rejectio n id: 1)
(node:10380) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr ecated. In the future, promise rejections that are not handled will terminate th e Node.js process with a non-zero exit code.
This is you actual error. You have to install JDK 1.8, the “or newer” is not really true. You seem to have JDK 10.
i’ll try it and get back to u, thanks for the help
just to get this straight, i have a newer version of jdk and i need to go back and install an older version (1.8)?
Exactly, that used to work for man y other people before so it is definitely worth a try.
i downloaded java8, this definitely made a difference, howerver, i got the following error that says i havn’t accepted license agreement with cordova! any chance u know what this is about?
File C:\Users\h2001\.android\repositories.cfg could not be loaded.
Checking the license for package Android SDK Platform 26 in C:\Users\h2001\AppDa ta\Local\Android\Sdk\licenses
Warning: License for package Android SDK Platform 26 not accepted.
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 co mplete the installation of the missing components using the Android Studio SDK M anager.
Alternatively, to learn how to transfer the license agreements from one workst ation 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 14m 59s
(node:10380) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with e xit 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 co mplete the installation of the missing components using the Android Studio SDK M anager.
Alternatively, to learn how to transfer the license agreements from one workst ation 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 14m 59s
at ChildProcess.whenDone (C:\Users\h2001\Desktop\myApp\platforms\android\cor dova\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:10380) 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(). (rejectio n id: 1)
(node:10380) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr ecated. In the future, promise rejections that are not handled will terminate th e Node.js process with a non-zero exit code.
Open Android Studio, go to the SDK Manager and accept the licence agreements.