Custom plugins in Android don't work

(I have created an Answer’s hub page post)

Hi,

I have implemented a Plugin based in the structure of the Module Advertising from Unreal Engine code. It contains 3 modules:

1 module to define a common interface class and the access to the core. This module reads the default provider defined by the config files.
another module to define windows code (extending the interface and writing windows-only code)
another like the one above just for android.

The plugin is another module that implements all Blueprint access to the first module.

At the moment the plugin compiles and works in windows. In android compiles and becomes part the pak file looking at the unreal editor logs apparently:

LogPlayLevel:Display: unrealpak: LogPakFile:Display: Added file Source: %PATH%/Plugins/WBPlugin/WBPlugin.uplugin Dest: …/…/…/Game/Plugins/WBPlugin/

LogPlayLevel:Display: unrealpak: LogPakFile:Display: Added file “Game/Plugins/WBPlugin/WBPlugin.uplugin”, 997 bytes.

However looking at the logcat logs from android (in Eclipse for example) :

06-23 09:20:55.553: D/UE4(11577): [2014.06.23-09.20.55:565] 0]LogLinker:Warning: Can’t find file ‘/Script/WBPlugin’

The plugin seems to compile fine in Android. Before I had that problem and managed to get it to compiled fine for Android due to a problem in the include lines in the cpp files, the sorting of listed modules in the plugin file (uplugin) and the LoadingPhase config in these. I include the .uplugin file for further information. (NOTE: It doesn’t allow me to upload files for some reason… Follow the link at the top to Answershub to find the plugin file)

Looking at UE AnswerHub and the forums most of the people suggest to add a line to DefaultEngine.ini :

[Plugins]
+EnabledPlugins=WahlapBoardPlugin

I have added that line(s) with the + and without it, and also with quotes and without them. I have also tried to add this to the Android config file (AndroidEngine.ini) (not initially in the project, I have created it), like in the DefaultEngine.ini. In all cases the log output is the same.

I wonder if there is a different way to add a plugin in Android or it is just not working right now in Android. If they work, if there is anything else I am missing?

Thanks

Hmm… All sounds okay to me. A couple of ideas:

  • You will need to add the plugin to your DefaultEngine.ini file, and you’ve got the right syntax. I notice that your .uplugin file is called WBPlugin.uplugin though: it’s this name which needs to be added to DefaultEngine.ini (not WahlapBoardPlugin). There’s an editor bug where the plugin window will store the enabled plugins in a place that will only work on your desktop platform, which is why you have to make this change manually.
  • The project that your testing with is a code project, isn’t it? The precompiled executable we include for content-only games has only a fixed set of plugins, and doesn’t support adding additional plugins in.

Ben

Hi Ben,

Thanks for the quick response.

It was a mistake copying it over to the forum. I renamed the files and names of the plugin in the forum, but forgot to rename the content of the .ini file when I post my question. In our project we use the same name in the .uplugin filename, content of .uplugin, plugin module classname, classname filename and defaultEngine.ini content. What you mention about the bug is exactly what I am experiencing. It just works on Desktop (windows) and not in Android. However, the names seem fine, so it is not the same reason.

It is a code project. Everything compiled from VS 2013 Desktop Express version.

A couple of quick questions just to be clear as the responses I have seen at the forums are not certain in this.

  • The line mentioned of [Plugins] should be at Myproject/Config/DefaultEngine.ini folder and not under Myproject/Config/Android/AndroidEngine.ini right?

  • How is the structure of the line exactly:

  • *]+EnabledPlugins=“PluginName”

  • *]EnabledPlugins=“PluginName”

  • *]+EnabledPlugins=PluginName

  • *]EnabledPlugins=PluginName

Thanks

The line should be +EnabledPlugins=“PluginName”, though I think the quotes are optional. It should be in Myproject/Config/DefaultEngine.ini; all the INI files are merged together to make the “final” INI files, and that Android one just allows you to define settings which are specific to Android only.

One of the differences with packaged standalone games is that plugins are linked in through static libraries (rather than being games). That invokes a peculiar behavior where the linker only includes an object file if it’s referenced by some other symbol. UnrealBuildTool inserts some glue code that makes sure the file containing module definitions isn’t stripped out, but I wonder if it’s stripping out the code that defines your classes. This page describes the scenario a bit (though the workaround doesn’t apply for building in Unreal):

Can you try calling something like UMyClass::StaticClass() for one of your plugin classes from your plugin’s StartupModule() function? That should force the linker to include the definitions.