# UE 4.8 ignoring PLATFORM\_ANDROID in generated.1 files

**URL:** <https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 31, 2015, 10:37pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244 "2015-07-31T22:37:34Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [July 31, 2015, 10:37pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/1 "2015-07-31T22:37:34Z")

</div>

After upgrading the UE4 4.8 I’m running into an Android compile error with the generated code.

I have a field defined that checks for the android platform symbol in the actor header.

```
#if PLATFORM_ANDROID
	tv_ouya_console_api_content_OuyaMod::OuyaMod _ouyaMod;
#endif
```

The implementation file also has an android platform check.

```
AOuyaMod::AOuyaMod(const class FObjectInitializer& PCIP)
: Super(PCIP)
#if PLATFORM_ANDROID
, _ouyaMod(0)
#endif
```

Yet the Engine.generated2.cpp code is acting like it ignored the android platform check.

```
Error	3	error : constructor for 'AOuyaMod' must explicitly initialize the member '_ouyaMod' which does not have a default constructor	C:\Public\OUYA_UnrealEngine-4_8\Engine\Intermediate\Build\Android\UE4Client\Inc\Engine\Engine.generated.2.cpp	4530	31	UE4
```

Maybe generate project files missed setting a symbol in the project? This is something that worked fine in 4.7 and broke after the 4.8 upgrade.

Here is the working branch:  
[https://github.com/tgraupmann/UnrealEngine/tree/4.7-OUYA](https://github.com/tgraupmann/UnrealEngine/tree/4.7-OUYA)

And I’m upgrading to 4.8 in the new branch.  
[https://github.com/tgraupmann/UnrealEngine/tree/4.8-OUYA](https://github.com/tgraupmann/UnrealEngine/tree/4.8-OUYA)

Here a link to the valid header on 4.7.  
[https://github.com/tgraupmann/UnrealEngine/blob/4.7-OUYA/Engine/Source/Runtime/Engine/Classes/OuyaSDK/OuyaMod.h#L222](https://github.com/tgraupmann/UnrealEngine/blob/4.7-OUYA/Engine/Source/Runtime/Engine/Classes/OuyaSDK/OuyaMod.h#L222)

Here a link to the valid implementation on 4.7.  
[https://github.com/tgraupmann/UnrealEngine/blob/4.7-OUYA/Engine/Source/Runtime/Engine/Private/OuyaSDK/OuyaMod.cpp#L59](https://github.com/tgraupmann/UnrealEngine/blob/4.7-OUYA/Engine/Source/Runtime/Engine/Private/OuyaSDK/OuyaMod.cpp#L59)

I usually define the PLATFORM\_ANDROID symbol in the Android make file.

> <https://github.com/ouya/ouya-sdk-examples/blob/master/Unreal/NativeUnrealPlugin/jni/Android.mk#L56>

Defining the PLATFORM\_ANDROID symbol was not previously required:  
[https://github.com/tgraupmann/UnrealEngine/blob/4.7-OUYA/Engine/Build/Android/Java/jni/Android.mk](https://github.com/tgraupmann/UnrealEngine/blob/4.7-OUYA/Engine/Build/Android/Java/jni/Android.mk)

**Update:**

I’ve added explicit Android platform checks:  
[https://github.com/tgraupmann/UnrealEngine/commit/f61847ddfdfb505cd12507ef6181296485a9ff1b](https://github.com/tgraupmann/UnrealEngine/commit/f61847ddfdfb505cd12507ef6181296485a9ff1b)

**Development Editor - Win64** builds successfully.

**Development Client - Android** fails to build with a few errors like a project is missing the PLATFORM\_ANDROID symbol when the source is generated…

I’m down to three odd errors…

```
Error	3	error : constructor for 'AOuyaModEditor' must explicitly initialize the member '_ouyaModEditor' which does not have a default constructor	C:\Public\OUYA_UnrealEngine-4_8\Engine\Intermediate\Build\Android\UE4Client\Inc\Engine\Engine.generated.2.cpp	4892	31	UE4
```

```
AOuyaModEditor::AOuyaModEditor(const class FObjectInitializer& PCIP)
: Super(PCIP)
#if PLATFORM_ANDROID
, _ouyaMod(0)
, _ouyaModEditor(0)
, _callbacksContentSave(0)
#endif
{
}
```

[https://github.com/tgraupmann/UnrealEngine/blob/4.8-OUYA/Engine/Source/Runtime/Engine/Private/OuyaSDK/OuyaModEditor.cpp#L56](https://github.com/tgraupmann/UnrealEngine/blob/4.8-OUYA/Engine/Source/Runtime/Engine/Private/OuyaSDK/OuyaModEditor.cpp#L56)

```
Error	4	error : constructor for 'AOuyaModScreenshot' must explicitly initialize the member '_ouyaModScreenshot' which does not have a default constructor	C:\Public\OUYA_UnrealEngine-4_8\Engine\Intermediate\Build\Android\UE4Client\Inc\Engine\Engine.generated.2.cpp	4973	31	UE4
```

```
AOuyaModScreenshot::AOuyaModScreenshot(const class FObjectInitializer& PCIP)
: Super(PCIP)
#if PLATFORM_ANDROID
, _ouyaModScreenshot(0)
#endif
{
}
```

[https://github.com/tgraupmann/UnrealEngine/blob/4.8-OUYA/Engine/Source/Runtime/Engine/Private/OuyaSDK/OuyaModScreenshot.cpp#L23](https://github.com/tgraupmann/UnrealEngine/blob/4.8-OUYA/Engine/Source/Runtime/Engine/Private/OuyaSDK/OuyaModScreenshot.cpp#L23)

```
Error	5	error : constructor for 'AOuyaContent' must explicitly initialize the member '_ouyaContent' which does not have a default constructor	C:\Public\OUYA_UnrealEngine-4_8\Engine\Intermediate\Build\Android\UE4Client\Inc\Engine\Engine.generated.1.cpp	52445	31	UE4
```

```
AOuyaContent::AOuyaContent(const class FObjectInitializer& PCIP)
: Super(PCIP)
#if PLATFORM_ANDROID
, _ouyaContent(0)
#endif
{
}
```

[https://github.com/tgraupmann/UnrealEngine/blob/4.8-OUYA/Engine/Source/Runtime/Engine/Private/OuyaSDK/OuyaContent.cpp#L59](https://github.com/tgraupmann/UnrealEngine/blob/4.8-OUYA/Engine/Source/Runtime/Engine/Private/OuyaSDK/OuyaContent.cpp#L59)

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [August 20, 2015, 6:02pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/2 "2015-08-20T18:02:56Z")

</div>

LOCAL\_CFLAGS := -DPLATFORM\_ANDROID -DANDROID -DECLIPSE

should be

LOCAL\_CFLAGS := -DPLATFORM\_ANDROID=1 -DANDROID=1 -DECLIPSE

Take a look at Engine/Source/Programs/UnrealBuildTool/Android/UEBuildAndroid.cs in SetUpEnvironment() for how we set the definitions.

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 6:22pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/3 "2015-08-20T18:22:09Z")

</div>

I see:

```
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_ANDROID=1");
```

So that looks right. It’s just some generated code process isn’t checking against this define when it included or skipped including:

```
AOuyaMod::AOuyaMod(const class FObjectInitializer& PCIP)
: Super(PCIP)
#if PLATFORM_ANDROID
, _ouyaMod(0)
#endif
```

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [August 20, 2015, 6:30pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/4 "2015-08-20T18:30:06Z")

</div>

#if PLATFORM\_ANDROID isn’t the same as #ifdef PLATFORM\_ANDROID. You need to set a value, in this case 1 as I said above.

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 6:49pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/5 "2015-08-20T18:49:00Z")

</div>

Gotcha I was just checking for non-zero. I’ll try checking with… #ifdef PLATFORM\_ANDROID

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [August 20, 2015, 6:51pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/6 "2015-08-20T18:51:44Z")

</div>

No, just use -DANDROID=1 instead of -DANDROID.

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 6:53pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/7 "2015-08-20T18:53:23Z")

</div>

Am I missing something? The line says:

```
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_ANDROID=1");
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("ANDROID=1");
```

It would make sense if I had something to add if it was:

```
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_ANDROID");
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("ANDROID");
```

???

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [August 20, 2015, 6:54pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/8 "2015-08-20T18:54:43Z")

</div>

I was talking about your Android.mk.

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 7:14pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/9 "2015-08-20T19:14:36Z")

</div>

Gotcha.  
C:\UnrealEngine\UnrealEngine\_4\_8\Engine\Build\Android\Java\jni\Android.mk

```
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := UE4
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libUE4.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_CFLAGS := -DPLATFORM_ANDROID=1 -DANDROID=1 -DECLIPSE
```

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 7:27pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/10 "2015-08-20T19:27:45Z")

</div>

I’m still getting the three errors.

```
25>C:\UnrealEngine\UnrealEngine_4_8\Engine\Intermediate\Build\Android\UE4Client\Inc\Engine\Engine.generated.2.cpp(4892,31): error : constructor for 'AOuyaModEditor' must explicitly initialize the member '_ouyaModEditor' which does not have a default constructor
25> DEFINE_VTABLE_PTR_HELPER_CTOR(AOuyaModEditor);
25> ^
25> C:\UnrealEngine\UnrealEngine_4_8\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectBase.h(1254,10) : note: expanded from macro 'DEFINE_VTABLE_PTR_HELPER_CTOR'
25> TClass::TClass(FVTableHelper& Helper) : Super(Helper) {};
25> ^
25> C:\UnrealEngine\UnrealEngine_4_8\Engine\Source\Runtime\Engine\Classes\OuyaSDK\OuyaModEditor.h(112,58) : note: member is declared here
25> tv_ouya_console_api_content_OuyaModEditor::OuyaModEditor _ouyaModEditor;
25> ^
25> C:\UnrealEngine\UnrealEngine_4_8\Engine\Source\Runtime\Launch\Private\Android\OuyaSDK_OuyaModEditor.h(31,7) : note: 'tv_ouya_console_api_content_OuyaModEditor::OuyaModEditor' declared here
25> class OuyaModEditor
25> ^
25>C:\UnrealEngine\UnrealEngine_4_8\Engine\Intermediate\Build\Android\UE4Client\Inc\Engine\Engine.generated.2.cpp(4973,31): error : constructor for 'AOuyaModScreenshot' must explicitly initialize the member '_ouyaModScreenshot' which does not have a default constructor
25> DEFINE_VTABLE_PTR_HELPER_CTOR(AOuyaModScreenshot);
25> ^
25> C:\UnrealEngine\UnrealEngine_4_8\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectBase.h(1254,10) : note: expanded from macro 'DEFINE_VTABLE_PTR_HELPER_CTOR'
25> TClass::TClass(FVTableHelper& Helper) : Super(Helper) {};
25> ^
25>
```

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 8:24pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/11 "2015-08-20T20:24:21Z")

</div>

I have to think the build process or some preprocessor macro is not checking for the android platform.

Nether check for the constructor implementation is working.

```
#ifdef PLATFORM_ANDROID

#if PLATFORM_ANDROID
```

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [August 20, 2015, 8:30pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/12 "2015-08-20T20:30:44Z")

</div>

Why are you building client? You should be building Development.

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 8:39pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/13 "2015-08-20T20:39:28Z")

</div>

I used `development client` successfully on both 4.6 and 4.7. I’ll try `development` with 4.8.

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 8:57pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/14 "2015-08-20T20:57:10Z")

</div>

Building `development` has the same issue.

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 20, 2015, 9:10pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/15 "2015-08-20T21:10:08Z")

</div>

I suspect you’ll just have to try it. It’s an easy repro since everything is checked in and there are no manual steps.

Clone special:  
`https://github.com/tgraupmann/UnrealEngine/`

Specifically grabbing the `4.8-OUYA` branch.

Run setup.cmd.

Build the project files.

Build the editor.

And then try to build the `android` development.

You’ll run into the generated errors.

\*\*\* The odd thing is this is code that worked in 4,7 but not in 4.,8.

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [August 26, 2015, 7:26pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/16 "2015-08-26T19:26:25Z")

</div>

I’ll try isolating the issue. Start with an EpicGames/4.8 checkout.

Drop the repo files into:

`Engine\Source\Runtime\Engine\Classes\Tests\TestAndroidConstructor.h`

```
#pragma once

#include "GameFramework/Actor.h"

#include "TestAndroidConstructor.generated.h"

/**
* Test Android Platform Specific Constructor Logic
*/
UCLASS()
class ATestAndroidConstructor : public AActor
{
	GENERATED_UCLASS_BODY()

#if PLATFORM_ANDROID
	int _testField;
#endif
};

```

`Engine\Source\Runtime\Engine\Private\Tests\TestAndroidConstructor.cpp`

```
#include "EnginePrivate.h"

#include "Tests/TestAndroidConstructor.h"

ATestAndroidConstructor::ATestAndroidConstructor(const class FObjectInitializer& PCIP)
: Super(PCIP)
#if PLATFORM_ANDROID
, _testField(0)
#endif
{
}

```

And then rerun `GenerateProjectFiles.bat`.

It’s odd can’t attach .h and .cpp files. Here’s links instead.

[http://tagenigma.com/unreal/TestAndroidConstructor.h](http://tagenigma.com/unreal/TestAndroidConstructor.h)

[http://tagenigma.com/unreal/TestAndroidConstructor.cpp](http://tagenigma.com/unreal/TestAndroidConstructor.cpp)

Okay and that builds successfully…

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [September 10, 2015, 1:52am UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/17 "2015-09-10T01:52:23Z")

</div>

I created a small repro project that reproduces the issue.

[https://github.com/tgraupmann/UnrealEngine/commit/0c1cc82617b6901eaad327fb352d5a087994086e](https://github.com/tgraupmann/UnrealEngine/commit/0c1cc82617b6901eaad327fb352d5a087994086e)

The issue is that if a class is defined on the Android platform that has a copy constructor, that class cannot be used by an actor class.

This was something that worked on 4.7, but not on 4.8.

I just needed the following files to reproduce the issue.

```
Engine/Source/Runtime/Engine/Classes/Tests/TestAndroidConstructor.h

Engine/Source/Runtime/Engine/Private/Tests/TestAndroidConstructor.cpp

Engine/Source/Runtime/Launch/Private/Android/TestAndroidClass.h

Engine/Source/Runtime/Launch/Private/Android/TestAndroidClass.cpp
```

---

<div class="post-metadata">

**Author:** ![tgraupmann](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tgraupmann](https://forums.unrealengine.com/u/tgraupmann)\
**Post date:** [September 10, 2015, 6:12pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/18 "2015-09-10T18:12:52Z")

</div>

I worked around the issue by avoiding using the copy constructor in the Android platform code.

Here is the fix.  
[https://github.com/tgraupmann/UnrealEngine/commit/dbb5d292371c92401aede394ad52bac144ec5db9](https://github.com/tgraupmann/UnrealEngine/commit/dbb5d292371c92401aede394ad52bac144ec5db9)

I’m now upgraded to UE 4.9.

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [September 10, 2015, 8:22pm UTC](https://forums.unrealengine.com/t/ue-4-8-ignoring-platform-android-in-generated-1-files/327244/19 "2015-09-10T20:22:49Z")

</div>

It was probably this change, not #if PLATFORM\_ANDROID causing the problem:

[GitHub commit](https://github.com/EpicGames/UnrealEngine/commit/3c450b947746aec52557f1ea4c7546ab3f0204ca)
