Package platform switching causes error windows.h

I wanted to make my game compatible with Oculus on windows and gear VR on Android. When I package the game targeting windows, the packaging runs successfully. However, when I change the target platform to Android, some errors with platform occurred.

For example,

MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: Creating makefile for TestOfficial (UnrealBuildTool.exe is newer)
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: NDK version: 19, GccVersion: 4.8
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: Compiling Native code with NDK API 'android-19'
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: Performing 10 actions (4 in parallel)
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: [1/10] clang++.exe DeviceIDManager.cpp [armv7-es2]
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: [4/10] clang++.exe ManagementServer.cpp [armv7-es2]
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: [3/10] clang++.exe Lobby.cpp [armv7-es2]
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: [2/10] clang++.exe GoogleProtobufTester.cpp [armv7-es2]
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: C:\Users\Mik\Documents\Unreal Projects\rift\Source\TestOfficial \DeviceIDManager.cpp(7,10) :  fatal error: 'Windows.h' file not found
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: #include <Windows.h>
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool:          ^
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: C:\Users\Mik\Documents\Unreal Projects\rift\Source\TestOfficial \GoogleProtobufTester.cpp(5,10) :  fatal error: 'AllowWindowsPlatformTypes.h' file not found
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: #include "AllowWindowsPlatformTypes.h"
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool:          ^
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: C:\Users\Mik\Documents\Unreal Projects\rift\Source\TestOfficial \ManagementServer.cpp(7,10) :  fatal error: 'AllowWindowsPlatformTypes.h' file not found
MainFrameActions: Packaging (Android (ETC2)): UnrealBuildTool: #include "AllowWindowsPlatformTypes.h"

It tell me that Windows.h and AllowWindowsPlatformTypes.h etc can not be found. There seems to be different include/library with different target platform in unreal.

What can be the best way of solving that issue?

But if I do need to use their functions, is there a way to go around it?

It looks like you are trying to include these in your project’s source files. You should remove them.

Put #if PLATFORM_WINDOWS / #endif around it.

hello, I’m having the same problem. if I put #if PLATFORM_WINDOWS / #endif around it of course the library is not included; but how can I handle all the other functions that I’m using from that library? What dependency can I use in its place, for Android?