Extended Latin alphabets in directory name cause build to fail

All of a sudden my builds started failing and AFAIK nothing beside’s the Ionic CLI’s version has changed on my system. Apparently the build fails because Gradle can’t access files in the cache, I’m getting a lot of errors like this:

C:\Users\K?ytt?j?\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.1.aar\eb29d8a598e5db6ae08600831fb85827\res\anim\tooltip_exit.xml: error: file not found.

The files Gradle is complaining about do exist, so that’s not the problem. Notice the “K?ytt?j?” part in the path. That’s supposed to be “Käyttäjä”. Unfortunately I can’t change the name of the home directory, and in any case it wasn’t a problem previously. Right now I can’t think of any other reason why the build would suddenly start failing.

I’ve tried deleting the whole cache and Gradle re-downloaded it without any problems, but it didn’t help with the build problem.

After all the not found errors Gradle prints this:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

Here’s the output from ionic info:

cli packages: (C:\Users\Käyttäjä\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 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:

    Android SDK Tools : 26.1.1
    Node              : v8.9.3
    npm               : 5.5.1
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\android\sdk

Misc:

    backend : legacy

It would seem my initial assumption about the cause was correct. The workaround is to move the Gradle user home directory someplace else by setting and environment variable before building:

set GRADLE_USER_HOME=C:\gradle
ionic cordova run android --livereload
1 Like