I have a problem with Android packaging, The packaging works fine without plugin, but the plugin makes lots of errors ( I was able to package it before I reinstalled Windows).
Using VS2015, CodeWorks1R7 (tried with 1R6-same problem, Windows SDK 8.1)
All the errors are about UNREALTYPE.H
Example of error:
In file included from Runtime/CoreUObject/Public/UObject/ScriptMacros.h:12: Runtime/CoreUObject/Public\UObject/UnrealType.h(3277,37): error: lambda capture ‘LocalMapLayoutForCapture’ is not used [-Werror,-Wunused-lambda-capture] [LocalKeyPropForCapture, KeyPtr, LocalMapLayoutForCapture](void NewElementKey) Runtime/CoreUObject/Public\UObject/UnrealType.h(3290,41): error: lambda capture ‘LocalMapLayoutForCapture’ is not used [-Werror,-Wunused-lambda-capture]
[LocalValuePropForCapture, ValuePtr, LocalMapLayoutForCapture](void NewElementValue)
Runtime/CoreUObject/Public\UObject/UnrealType.h(3786,47): error: lambda capture ‘LocalSetLayoutForCapture’ is not used [-Werror,-Wunused-lambda-capture]
[LocalElementPropForCapture, ElementToAdd, LocalSetLayoutForCapture](void* NewElement)**
Aww those Epic d0r#s, what they make people to do. Ok. First of all Unreal build tool doesn’t swallow NDK19 for several reasons, one of which being for example that Unreal uses PhysX3.4 of Nvidia as external library, and thus is pinned down to their Android configurations, which are NDK15 tops. If you managed to compile your thing with NDK19 u r awesome, and please post here the manual how.
Now, the reason for the error you posted is this:
In the very basic, lowest level include files of Unreal Engine there are several lambda expressions that capture more variables in the capture list, then used in actual expression body. This will compile and work. It’s like, say, you are preparing for hiking trip, and took your favorite origami along. Not a big deal if you r careful.
Now, Android NDK compiles with rather uptight configuration. And this is veeery legit, since Android is meant to run on rather weak hardware. Look at IOS certification tests and compare if you like. It is configured on purpose to throw warning on gratuitous lambda captures. That’s your hiking buddy legitimately warning you, that taking origami into a hiking trip might just be not the best idea for origami lifetime. Again, it’s up to you. Legit? Yes.
Now, UBT (UnrealBuildTool) gives the compiler few more flags, one of which being f@#1ng -WarningsAsErrors ! It’s hypothetical you deciding, that if your hiking buddy will have literally ANY complain or constructive critics about your gear, you will SHOOT YOURSELF IN THE HEAD! Rather harsh, isn’t it?
The solution will be next:
Add next lines to the topmost header of your include hierarchy
#pragma warning (push)
#pragma warning (disable:4668) // 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'. This is for Unreal to stop complaining, when u r not building 4 Android.
#if defined( __clang__ ) && ( __clang_major__ < 6 )
// clang-5 gives a spurious warning about not using the captured `ohandle`. Unreal uses NDK15, which falls into this category.
#pragma clang diagnostic warning "-Wunused-lambda-capture" // Downgrade -Wunused-lambda-capture to warinig.
#pragma clang diagnostic ignored "-Wunused-lambda-capture" // Ignore it.
#pragma warning (pop)
Hopefully it’ll solve. If u r getting the error still, complaining about YourProjectName.generated.cpp
then u r screwed. Post here, and i will post a workaround, which is ugly, bad, but unfortunately the only way i found to pacify UHT(UnrealHeaderTool).
If u r not developing plugin, or can use Unreal locally, just go to UnrealType.h and fix the d@mn problem by commenting out the unused variables in the capture list. This will be right and gracious thing to do.