I've found the problem.
I changed the ninja parameter -j from 1000 to 50 in the script generate_gradle.py and it works.
old:
cmd =[
os. path. join (find_depot_tools. DEPOT_TOOLS_PATH,' ninja'),
'-C',
output_dir,
'-j1000',
]
new:
cmd =[
os. path. join (find_depot_tools. DEPOT_TOOLS_PATH,' ninja'),
'-C',
output_dir,
'-j50',
]