* What went wrong: java.io.IOException: Invalid argument

i face java.io IOException invalid argument error please help me

E:\my work\hybrid\Kazbek\frount end\Казахские-песни>ionic cordova build
? What platform would you like to build: ios, android: android
Running app-scripts build: --build --iscordovaserve --externalIpRequired --nobrowser

[10:20:54] build dev started …
[10:20:54] clean started …
[10:20:54] clean finished in 7 ms
[10:20:54] copy started …
[10:20:54] transpile started …
[10:20:58] transpile finished in 3.30 s
[10:20:58] preprocess started …
[10:20:58] deeplinks started …
[10:20:58] deeplinks finished in 51 ms
[10:20:58] preprocess finished in 55 ms
[10:20:58] webpack started …
[10:20:58] copy finished in 3.68 s
[10:21:09] webpack finished in 11.58 s
[10:21:09] sass started …
[10:21:10] sass finished in 1.25 s
[10:21:10] postprocess started …
[10:21:10] postprocess finished in 10 ms
[10:21:10] lint started …
[10:21:10] build dev finished in 16.29 s

cordova build android
× Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

    ANDROID_HOME=C:\Users\rajan\AppData\Local\Android\sdk
    JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_144

    FAILURE: Build failed with an exception.

    * What went wrong:
    java.io.IOException: Invalid argument

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Error: cmd: Command failed with exit code 1

E:\my work\hybrid\Kazbek\frount end\Казахские-песни>ionic info

  • Gathering environment info

cli packages:

@ionic/cli-plugin-cordova       : 1.5.0 (E:\my work\hybrid\Kazbek\frount end\Казахские-песни\node_modules\@ionic\cli-plugin-cordova)
@ionic/cli-plugin-ionic-angular : 1.4.0 (E:\my work\hybrid\Kazbek\frount end\Казахские-песни\node_modules\@ionic\cli-plugin-ionic-angular)
@ionic/cli-utils                : 1.6.0 (E:\my work\hybrid\Kazbek\frount end\Казахские-песни\node_modules\@ionic\cli-utils)
ionic (Ionic CLI)               : 3.6.0 (E:\my work\hybrid\Kazbek\frount end\Казахские-песни\node_modules\ionic)

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.0.2
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.5.3

System:

Node : v6.11.1
OS   : Windows 10
npm  : 3.10.10

try complete command at once like:
ionic cordova build android

E:\my work\hybrid\Kazbek\frount end\Казахские-песни>ionic cordova build android
Running app-scripts build: --build --iscordovaserve --externalIpRequired --nobrowser

[10:27:11] build dev started …
[10:27:11] clean started …
[10:27:11] clean finished in 7 ms
[10:27:11] copy started …
[10:27:11] transpile started …
[10:27:15] transpile finished in 3.61 s
[10:27:15] preprocess started …
[10:27:15] deeplinks started …
[10:27:15] deeplinks finished in 53 ms
[10:27:15] preprocess finished in 56 ms
[10:27:15] webpack started …
[10:27:15] copy finished in 4.00 s
[10:27:27] webpack finished in 12.27 s
[10:27:27] sass started …
[10:27:29] sass finished in 1.44 s
[10:27:29] postprocess started …
[10:27:29] postprocess finished in 11 ms
[10:27:29] lint started …
[10:27:29] build dev finished in 17.47 s

cordova build android
× Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

    ANDROID_HOME=C:\Users\rajan\AppData\Local\Android\sdk
    JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_144

    FAILURE: Build failed with an exception.

    * What went wrong:
    java.io.IOException: Invalid argument

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Error: cmd: Command failed with exit code 1

**i rename Казахские-песни to app problem is resolve **

now error is
E:\my work\hybrid\Kazbek\frount end\work>ionic cordova build android
Running app-scripts build: --build --iscordovaserve --externalIpRequired --nobrowser

[11:24:23] build dev started …
[11:24:23] clean started …
[11:24:23] clean finished in less than 1 ms
[11:24:23] copy started …
[11:24:23] transpile started …
[11:24:25] transpile finished in 2.57 s
[11:24:25] preprocess started …
[11:24:25] deeplinks started …
[11:24:25] deeplinks finished in 31 ms
[11:24:25] preprocess finished in 31 ms
[11:24:25] webpack started …
[11:24:26] copy finished in 2.82 s
[11:24:34] webpack finished in 8.68 s
[11:24:34] sass started …
[11:24:35] sass finished in 860 ms
[11:24:35] postprocess started …
[11:24:35] postprocess finished in 15 ms
[11:24:35] lint started …
[11:24:35] build dev finished in 12.22 s

cordova build android
× Running command - failed!

[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova build android (exit code 1):

    ANDROID_HOME=C:\Users\rajan\AppData\Local\Android\sdk
    JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_144
    Subproject Path: CordovaLib
    Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details

    FAILURE: Build failed with an exception.

    * What went wrong:
    Unable to start the daemon process.
    This problem might be caused by incorrect configuration of the daemon.
    For example, an unrecognized jvm option is used.
    Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.html
    Please read the following process output to find out more:
    -----------------------
    Error occurred during initialization of VM
    Could not reserve enough space for 2097152KB object heap


    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    Error: cmd: Command failed with exit code 1 Error output:
    FAILURE: Build failed with an exception.

    * What went wrong:
    Unable to start the daemon process.
    This problem might be caused by incorrect configuration of the daemon.
    For example, an unrecognized jvm option is used.
    Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.html
    Please read the following process output to find out more:
    -----------------------
    Error occurred during initialization of VM
    Could not reserve enough space for 2097152KB object heap


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

Just to make things clear, the issue (java.io.IOException: Invalid argument) was non-English characters in path (or app name or whatever).
Had this issue myself, the solution is to either rename whatever is in non-English to English or just move project folder.