"system.componentmodel.win32exception" when trying to run stockfish binary file for android

I am creating a Chess Game in Unity. I want to build my game for Android. For AI I am using Stockfish Chess Engine and more particularly “Stockfish-9-arm64v8” file which is a binary file for Android. I have created a C# script which creates a process to run this binary file and communicate with it. When I try to Start my process the exception is raised →

`try{
mProcess.Start()
}
catch(Exception e){
Helper.PrintString(e.GetType().ToString()); // ----------------(1)
Helper.PrintString(e.Message); // --------------(2)
}

/*
(1) is printing :
system.componentmodel.win32exception
(2) is printing :
ApplicationName = ‘/storage/emulated/0/Android/data/com.chessmania.chess/files/Stockfish-9-arm64v8’, CommandLine = ‘’, CurrentDirectory = ‘’
*/`

Also my process info parameters are as follows:

ProcessStartInfo si = new ProcessStartInfo() { FileName = System.IO.Path.Combine(Application.persistentDataPath, "Stockfish-9-arm64v8"), UseShellExecute = false, CreateNoWindow = true, RedirectStandardError = true, RedirectStandardInput = true, RedirectStandardOutput = true };

Can anyone please help me with it. I have been trying to resolve this issue past few days but unable to. Does it have something to do with file permission?? I mean shall I include some arguments in my ProcessInfoParameters to forcefully run the binary file?? I really don’t know if this is the problem or something else? Correct me from the start if I am wrong.

I just want to integrate Stockfish Chess Engine with with Unity Project and build it for Android Platform. If anyone has any ideas or suggestions or if anyone has dealt with similar problem before, please let me know how to solve this issue. I would be grateful. Thanks for bearing with me till here :slight_smile:

Are you storing this file in assets (assets of android project)?
Try to use this command “chmod 744 filepath” to grant execute permission to your file before using it.

Running an external EXE file from Unity - Questions & Answers - Unity Discussions

If you have root on your device, you can run this command in adb shell without code modification.