How to build and apk package for Android from a c/c++ engine?
In the past I have used the compiler in the NDK and built an executable but it seems it doesn't work anymore to Android so the only solution is to create an apk package. I've installed Android Studio but I don't fully understand how the engine should be called from the java code. I've read that the engine have to support the OEX standard but I've not found descriptions of this standard. I've googled a lot but I've not found any informations. Could you help me?
Build apk package for Android from a c/c++ engine
Moderators: hgm, Rebel, chrisw
-
- Posts: 217
- Joined: Fri Apr 11, 2014 10:45 am
- Full name: Fabio Gobbato
-
- Posts: 819
- Joined: Fri Dec 01, 2006 10:46 pm
- Location: Mountain View, CA, USA
- Full name: Aart Bik
Re: Build apk package for Android from a c/c++ engine
Hi Fabio,
Here you can find details on the Android Open Exchange format (OEX). There is also the Android Chessbase compatible format, but that never became widespread because Chessbase insisted on keeping this a proprietary format. Chess for Android supports both formats though.
You can read a bit more on why engines no longer import as before (which made me really sad as well) in this W^X thread.
Aart
Here you can find details on the Android Open Exchange format (OEX). There is also the Android Chessbase compatible format, but that never became widespread because Chessbase insisted on keeping this a proprietary format. Chess for Android supports both formats though.
You can read a bit more on why engines no longer import as before (which made me really sad as well) in this W^X thread.
Aart
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Build apk package for Android from a c/c++ engine
Looks really complicated, with the reference site not even working properly.
Alternative: install Droidfish from the Fdroid store and use engines as executables like before. Problem solved.
Alternative: install Droidfish from the Fdroid store and use engines as executables like before. Problem solved.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 819
- Joined: Fri Dec 01, 2006 10:46 pm
- Location: Mountain View, CA, USA
- Full name: Aart Bik
Re: Build apk package for Android from a c/c++ engine
Yeah, I guess that site did not age well. Probably a better place to browse around is gkalab's github, although I am not sure where the official site (if any) resides nowadays (pointers welcome so I can update my website links too).
-
- Posts: 157
- Joined: Fri Apr 30, 2021 7:19 am
- Full name: Pedro Duran
Re: Build apk package for Android from a c/c++ engine
The possible solutions that comes to my mind are:
1) Unity project, you need to know C# and how to use unity game engine, you build your C++ engine into a .dll library and then you make a "wrapper" in C# that calls the native code into your C++ plugin, it is basically a "brige" between C# application and your C++ plugin.
2) Microsoft's Xamarin, the same as Unity, you need to import your engine as a library and use it in the C# application.
3) Google's Android studio, i think that there is a way to import C++ plugins into android studio, but this time you'll need to know Java or Kotlin
Some links:
Android studio:
https://developer.android.com/studio/pr ... ative-code
Xamarin:
https://docs.microsoft.com/en-us/xamari ... tform/cpp/
Unity:
https://joinerda.github.io/DLLs-And-Unity/
Good luck!
Another thing: be sure that you don't use any OS specific features into your C++ code, or you'll end up with tons of errors, or at least be sure that your code is fully multi-platform!
1) Unity project, you need to know C# and how to use unity game engine, you build your C++ engine into a .dll library and then you make a "wrapper" in C# that calls the native code into your C++ plugin, it is basically a "brige" between C# application and your C++ plugin.
2) Microsoft's Xamarin, the same as Unity, you need to import your engine as a library and use it in the C# application.
3) Google's Android studio, i think that there is a way to import C++ plugins into android studio, but this time you'll need to know Java or Kotlin
Some links:
Android studio:
https://developer.android.com/studio/pr ... ative-code
Xamarin:
https://docs.microsoft.com/en-us/xamari ... tform/cpp/
Unity:
https://joinerda.github.io/DLLs-And-Unity/
Good luck!
Another thing: be sure that you don't use any OS specific features into your C++ code, or you'll end up with tons of errors, or at least be sure that your code is fully multi-platform!
-
- Posts: 690
- Joined: Mon Apr 19, 2010 7:07 pm
- Location: Sweden
- Full name: Peter Osterlund
Re: Build apk package for Android from a c/c++ engine
You can have a look at the texel app project here:
https://github.com/peterosterlund2/texelapp
I don't think it uses the latest version of the OEX code but it works for me anyway.
https://github.com/peterosterlund2/texelapp
I don't think it uses the latest version of the OEX code but it works for me anyway.
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: Build apk package for Android from a c/c++ engine
This is working fine indeed, but is droidfish handling tourney or just engine versus human ?
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Build apk package for Android from a c/c++ engine
No idea. I don't regard engine tournaments on a phone as relevant use case.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net