@JonB it's a clever idea but unfortunately doesn't work with Qt Creator.
I tried setting Android NDK location to C:\android-ndk-r20b... but then there are errors in Qt Creator immediately:
Android NDK directory structure is incorrect
Android NDK installed into a path without spaces.
For fun, I tried the following and it works. I can compile in Qt Creator now but it's such a roundabout way to hack this.
Projects > Android for arm64-v8a (Clang Qt 5.13.2 for Android ARM64-v8a) > Build
under Build Steps click on Add Build Step drop down to get an option Process Custom Step
click on Custom Process Step
on the top right corner of the new step (only when the mouse hovers over the step) there's a little upwards pointing arrow, click on it until it is under the qmake step but before the make step
in the Command field: python
in the Arguments field: full path to a Python script that I'll copy below
Basically, it does the following:
run qmake as usual, which will generate a Makefile with faulty NDK path
run a custom Python script to change C:\android-ndk-r20b to C:/android-ndk-r20b in the Makefile
run make as usual
My first attempt was to replace all \ with / in the Makefile but it failed, so I modified the script to only replace the \ with / in the NDK path (as you'll see in the script below).
In Linux there's probably a much simpler way to do this with just a sed command but I'm in Windows and don't feel like spending any more time on this issue. However, also in Linux, this likely wouldn't be an issue to begin with as everything likely already uses /.
I can now compile the project in Qt Creator 5.13.2.
Here's the Python script I'm using, note that it's just a copy/paste/modify from the first search result I found as I'm not strong in Python. Also, this requires that Python is installed and found your PATH (i.e. in Command Prompt, run "python --version" if it doesn't work, then this approach won't work for you). If you modify your PATH you'll need to restart Qt Creator.
Also, the path to my python script is currently absolute, i.e. C:\full_path_to_script\fixup.py. I didn't spend any time trying to add it to the project and use a proper relative path/environment variable for the script.
Here is the Python script I used:
import re
def case_insensitive_search_and_replace(file_path, search_word, replace_word):
with open(file_path, 'r') as file:
file_contents = file.read()
pattern = re.compile(re.escape(search_word), re.IGNORECASE)
updated_contents = pattern.sub(replace_word, file_contents)
with open(file_path, 'w') as file:
file.write(updated_contents)
# Example usage
# Note: This is the full absolute path to the Makefile that is auto-generated by qmake:
file_path = r'C:\code\project_path\build-project_path-Android_for_arm64_v8a_Clang_Qt_5_13_2_for_Android_ARM64_v8a-Debug\Makefile'
# you'll need to change this to match your NDK path
search_word = 'C:\\android-ndk-r20b'
replace_word = 'C:/android-ndk-r20b'
case_insensitive_search_and_replace(file_path, search_word, replace_word)