F:\211Engine\castle-engine-master\examples\mobile\game_services>castle-engine package --target=android --package-format=android-app-bundle
Deleted 0 files
Compiling project “game_services_demo” for target “android” in mode “release”.
Exception “Exception”:
The android source library in “F:\211Engine\castle-engine-master\examples\mobile\game_services\castle-engine-output\android\game_services_demo_android.lpr” must export the necessary JNI functions for our integration to work. See the examples in “castle-engine/tools/build-tool/data/android/library_template_xxx.lpr”.
It’s simplest to fix this error by removing the “android_source” from CastleEngineManifest.xml, and using only the “game_units” attribute in CastleEngineManifest.xml. Then the correct Android code will be auto-generated for you.
Compilation of this example goes OK for me, using latest build tool and latest CGE sources.
We have recently changed one internal function in the Android process, that could be related to the error message you see (a different JNI function name must be exported). It would indicate that you can have a mixed Castle Game Engine installation. Maybe the build tool (castle-engine.exe
) available on Windows $PATH comes from one CGE version, but it uses an Android template from a different CGE version?
Looking at your logs above, this may be the case: I can see at least 2 paths,
f:/castle game engine
f:/211Engine/castle-engine-master
Please make sure you have the latest CGE version from Download | Castle Game Engine , and one CGE version In particular, the build tool (
castle-engine.exe
) must come from the same location where you have the editor, where you have engine sources. If you have set CASTLE_ENGINE_PATH
environment variable, it also must point to the same location.
P.S. Added “Android” development category to the forum Hopefully will be useful!
Running “F:\Castle Game Engine\bin\castle-engine.exe package --mode=debug --target=android --fast”
Compiling project “game_services_demo” for target “android” in mode “debug”.
Exception “Exception”:
The android source library in “F:\Castle Game Engine\examples\mobile\game_services\castle-engine-output\android\game_services_demo_android.lpr” must export the necessary JNI functions for our integration to work. See the examples in “castle-engine/tools/build-tool/data/android/library_template_xxx.lpr”.
It’s simplest to fix this error by removing the “android_source” from CastleEngineManifest.xml, and using only the “game_units” attribute in CastleEngineManifest.xml. Then the correct Android code will be auto-generated for you.
Command finished with status 1.
I worked on the environment for 2 days, but the compilation just reported an error. I don’t know where the problem occurred
It’s still the same error I’m afraid.
You have multiple Castle Game Engine installations on your system, and while you use CGE build tool from F:\Castle Game Engine\
, it most likely uses a template from a different engine directory, indicated by the CASTLE_ENGINE_PATH
environment on your system.
Check your CASTLE_ENGINE_PATH
environment variable, my guess is it points to a different engine installation. See e.g. https://www.howtogeek.com/787217/how-to-edit-environment-variables-on-windows-10-or-11/ on how to check environment variables. Note that we don’t advise to set / modify environment variables at all anymore, just always build from CGE editor.
Check also CGE editor configuration, “Preferences → General”, does it specify any engine path? Leave it blank to auto-detect.
Something you can also try: just create a new Windows user account. This will be independent from some of the settings of your previous account, like user-specific environment variables. In that new account, everything should work.
The packaging of Delphi Android is very simple, I hope it can be supported
Finally, Android compilation passed
I’m happy it’s solved, and from one of your message (I see now deleted) I understand it was indeed an issue of having an old copy of the engine being referenced.
Yes. The Delphi + Android port will most likely just use the Android tooling provided by Delphi. We want to make it happen, see Delphi | Manual | Castle Game Engine . Support towards this goal on Patreon is most welcome!
Though, note that the issue your describe in this thread will always be problematic. It’s not only about Android, the problem just manifested by accident on Android in this case, but a “two engine versions mixed” could result in all sorts of problems, for all platforms. That is, if you have two engine installations on your system, and you execute CGE build tool from one engine version, while having some setting (like CASTLE_ENGINE_PATH
) refer to another, it can always lead to some problems.
A similar thing would happen if you try to copy around Delphi or FPC or most other tools installed directories, and then mix their versions
I have improved now our logging around this, though. At least we can warn in some typical cases, like when the build seems to be executed in a different directory than the engine. With the latest engine version, you will get a warning like this:
castle-engine: Warning: $CASTLE_ENGINE_PATH environment variable points to a different directory than the one detected from the executable path: “…” vs “…”. This may be a mistake, possibly you have two (different) engine versions installed. Please check your environment, likely remove one of the engine versions or undefine CASTLE_ENGINE_PATH to not point to the engine that shall be unused.