My IONIC App doesn't run in an emulated device

Hi, when I try to launch my Test App in an Android Emulator it doesn’t work.
With
ionic cordova run android
or
ionic cordova emulate android
it doesn’t launch nothing.
Where is the problem?

The problem is you didn’t give us enough information.

What does that mean? Are you getting no output at all in the console? Error message? Successful output, but still not app launch? What kind of emulated device are you using?

What is your ionic info output?

Excuse me, now I’ll try to be more accurate.
“It doesn’t work” and “It doesn’t launch nothing” means that the App is never launched into an emulator.
I’ve this output in Console:

Running app-scripts build: --platform android --target cordova
[15:36:39] build dev started …
[15:36:40] clean started …
[15:36:41] clean finished in 306 ms
[15:36:41] copy started …
[15:36:42] deeplinks started …
[15:36:42] deeplinks finished in 44 ms
[15:36:42] transpile started …
[15:37:12] transpile finished in 29.23 s
[15:37:12] preprocess started …
[15:37:12] preprocess finished in 2 ms
[15:37:12] webpack started …
[15:37:14] copy finished in 33.52 s
[15:37:34] webpack finished in 22.48 s
[15:37:34] sass started …
Without from option PostCSS could generate wrong source map and will not find
Browserslist config. Set it to CSS file path or to undefined to prevent this w
arning.
[15:37:43] sass finished in 8.58 s
[15:37:43] postprocess started …
[15:37:43] postprocess finished in 93 ms
[15:37:43] lint started …
[15:37:43] build dev finished in 63.46 s

cordova run android
Android Studio project detected

[15:38:27] lint finished in 44.35 s
ANDROID_HOME=C:\Users\f.menghini\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk-9.0.1
(node:4156) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): Requirements check failed for JDK 1.8 or greater
(node:4156) DeprecationWarning: Unhandled promise rejections are deprecated. In
the future, promise rejections that are not handled will terminate the Node.js p
rocess with a non-zero exit code.

[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?

No error message as I can see, I think that this is a successful output, but app still not launch as I’ve told you.

Ionic info output:

cli packages: <C:\Users…>
@ionic/cli-utils : 1.19.0
ionic : 3.19.0

global packages:
cordova : 8.0.0

local packages:
@ionic/app-scripts : 3.1.6
Cordova Platforms: android 7.0.0
Ionic Framework : ionic-angular 3.9.2

System:
Node : v7.9.0
npm : 4.2.0
OS : Windows 7

Environment Variables:
ANDROID_HOME : not set

Misc:
backend : pro

This is an error message. Your JDK 9 is not compatible with Cordova. Install JDK 8.

(And check with ionic cordova requirements again)

Thank you very much!
I’ve downgraded my JDK and checked the requirements as you suggested.
It’s all ok but now, with
ionic cordova run android
I’ve this output:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
aapt2 is missing on 'C:\Users\f.menghini\AppData\Local\Android\sdk\build-tools
\27.0.3\aapt2.exe'

* 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 19s
21 actionable tasks: 4 executed, 17 up-to-date
(node:1096) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 1): Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
aapt2 is missing on 'C:\Users\f.menghini\AppData\Local\Android\sdk\build-tools
\27.0.3\aapt2.exe'

* 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 19s
(node:1096) DeprecationWarning: Unhandled promise rejections are deprecated. In
the future, promise rejections that are not handled will terminate the Node.js p
rocess with a non-zero exit code.

[OK] Your app has been deployed.
     Did you know you can live-reload changes from your app with --livereload?

What’s happen?

What does ionic cordova requirements return now?

Does C:\Users\f.menghini\AppData\Local\Android\sdk\build-tools \27.0.3\aapt2.exe exist?

ionic cordova requirements

Returns:

Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-27, android-26
Gradle: installed C:\Program Files\Android\...

I’ve checked the path and the .exe doesn’t exist, there is an aapt.exe but there isn’t the aapt2.exe :frowning:

Now duplicated at Ionic cordova run android FAILURE