I continue to investigate the issue, but in the meantime, did other chess app developers for Android encounter this issue already?
I'm just a Java developer and I use the engines (*.so) in my apps "Chess for All", "Chess Engines OEX" and "Stockfish Engines OEX". Bernhard C. März (user: shogi4fun) supports me in compiling some engines. Below is my experience with the SDK >= 29 problems.
Cannot run program "/data/user/0/com.package.name/files/engine.exe": error=13, Permission denied #343 at targetSdkVersion 29
This error is incomprehensible. This path is the external app directory. There shouldn't be any r/w problems here. Does the error also come if you set "targetSdkVersion 29" in build.gradle (module)?
As far as I know it is not possible to implement all functionality currently in DroidFish using targetSdkVersion 29, so the only option is to use targetSdkVersion 28 and don't distribute the app in the play store.
I have already set all my chess apps to "targetSdkVersion 29". In Chess for All I also activated this option in the manifest:
android:requestLegacyExternalStorage = "true"
This option is ignored from SDK version >= 30. So I've postponed the problem by one version. From API >= 30, it is no longer possible to set file activities in the external storage area (sd card) without directory permission. Access to the external app directory (getExternalFilesDir()) is allowed without permissions.
Is the OEX standard the way to go or even this is impacted ?
Gerhard Kalab did a good job with the OEX tool (com.kalab.chess.enginesupport). The engines are stored in a safe area and if the engine does not access the file system, there should be no problem with SDK >= 29.
I only use OEX in my apps to provide the engines. Engines that do not require file access run without problems. In order to get the file access problem under control, I have already tried a few things with my engine specialist Berhard C. März, here is the result:
Only an embedded variant (E.g. Stockfish Engines OEX app, engine "Stockfish 20200926 NNUE") actually works without problems.
A solution to provide additional files by copying them in the OEX app, the engine works (E.g. Chess Engines OEX app, Engine Rodent IV). For the engine developer, however, the effort is very high. Separate directory structures must be defined for each OEX app. An additional problem is that if the user does not open the app after installing the OEX app, the files are not copied.
Another solution is to give the user the option of defining the path/file in the GUI app via the UCI options (String). I realized this in the Chess for All app, UCI options (see info button). However, the effort is very high for both the user and the developer.
I think that these file delivery problems in OEX (Engine / OEX-App / GUI-App) can be solved.
The biggest problem for me with these new file accesses in SDK >= 29 is the fact that you no longer have direct access to the important "File" and "RandomAccessFile" classes. The files must be in the external storage area (persistent) and access to the path/file is essential. It is not possible with a file manager plus directory permission to get the files in the "File" format. All attempts failed.
The only possibility that I found in a documentation is the new permission MANAGE_EXTERNAL_STORAGE. However, whether Google will release this for chess apps is more than questionable. Here is the link:
https://developer.android.com/training/ ... -all-files
How should a chess app work without saving, reading and changing data? A chess app without PGN processing?
Does anyone have a solution to this problem?
Sources:
https://github.com/c4akarl