# Android packaging fails with errors in GameActivity.java

**URL:** <https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300>\
**Category:** Platform & Builds\
**Tags:** unreal-engine, question\
**Created:** [June 1, 2024, 1:51am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300 "2024-06-01T01:51:26Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![virtualyhere](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@virtualyhere](https://forums.unrealengine.com/u/virtualyhere)\
**Post date:** [June 1, 2024, 1:51am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/1 "2024-06-01T01:51:26Z")

</div>

Hi everyone,

When packaging for Android on UE5.3 there are no errors.  
When packaging for Android on UE5.4 it fails with errors in GameActivity.java:

```auto
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Z:\app\src\main\java\com\epicgames\unreal\GameActivity.java:782: error: cannot find symbol
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): activityContext.runOnUiThread(new Runnable()
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ^
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): symbol: method runOnUiThread(<anonymous Runnable>)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): location: variable activityContext of type ContextWrapper
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Z:\app\src\main\java\com\epicgames\unreal\GameActivity.java:1061: error: cannot find symbol
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): activityContext.runOnUiThread(new Runnable()
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ^
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): symbol: method runOnUiThread(<anonymous Runnable>)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): location: variable activityContext of type ContextWrapper
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Z:\app\src\main\java\com\epicgames\unreal\GameActivity.java:1086: error: cannot find symbol
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): activityContext.runOnUiThread(new Runnable()
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ^
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): symbol: method runOnUiThread(<anonymous Runnable>)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): location: variable activityContext of type ContextWrapper
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Z:\app\src\main\java\com\epicgames\unreal\GameActivity.java:1152: error: cannot find symbol
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): activityContext.runOnUiThread(new Runnable()
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ^
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): symbol: method runOnUiThread(<anonymous Runnable>)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): location: variable activityContext of type ContextWrapper
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Z:\app\src\main\java\com\epicgames\unreal\GameActivity.java:1173: error: cannot find symbol
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): activityContext.runOnUiThread(new Runnable()
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ^
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): symbol: method runOnUiThread(<anonymous Runnable>)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): location: variable activityContext of type ContextWrapper
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Z:\app\src\main\java\com\epicgames\unreal\GameActivity.java:1193: error: cannot find symbol
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): activityContext.runOnUiThread(new Runnable()
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ^
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): symbol: method runOnUiThread(<anonymous Runnable>)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): location: variable activityContext of type ContextWrapper
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Z:\app\src\main\java\com\epicgames\unreal\GameActivity.java:1235: error: cannot find symbol
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): activityContext.runOnUiThread(new Runnable()
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): ^
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): symbol: method runOnUiThread(<anonymous Runnable>)
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): location: variable activityContext of type ContextWrapper
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Note: Some input files use or override a deprecated API.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Note: Recompile with -Xlint:deprecation for details.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): 7 errors
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): > Task :app:compileReleaseJavaWithJavac FAILED
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): 69 actionable tasks: 69 executed
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): * What went wrong:
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): Execution failed for task ':app:compileReleaseJavaWithJavac'.
UATHelper: Packaging (Android (Multi:ASTC,DXT,ETC2)): > Compilation failed; see the compiler error output for details.

```

I have a C++ project, so when I comment out the following lines from .Target.cs it works without errors but there is no AdMob support:

```auto
		if (Target.Platform == UnrealTargetPlatform.Android)
		{
			ExtraModuleNames.Add("OnlineSubsystemGooglePlay");
			ExtraModuleNames.Add("OnlineSubsystem");
			ExtraModuleNames.Add("AndroidAdvertising");
		}

```

Does anyone have any idea how to package for Android on UE5.4, with AdMob support?

Thanks.

---

<div class="post-metadata">

**Author:** ![Readhunterbd1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Readhunterbd1](https://forums.unrealengine.com/u/Readhunterbd1)\
**Post date:** [June 3, 2024, 12:13pm UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/2 "2024-06-03T12:13:48Z")

</div>

you got any solution

---

<div class="post-metadata">

**Author:** ![virtualyhere](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@virtualyhere](https://forums.unrealengine.com/u/virtualyhere)\
**Post date:** [June 4, 2024, 12:11am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/3 "2024-06-04T00:11:02Z")

</div>

No, the problem still persists, as described above.

Edit: I just updated to 5.4.2 and I get the same errors. Even commenting out the lines in Target.cs causes the errors. Any ideas?

---

<div class="post-metadata">

**Author:** ![Readhunterbd1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Readhunterbd1](https://forums.unrealengine.com/u/Readhunterbd1)\
**Post date:** [June 16, 2024, 4:58am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/4 "2024-06-16T04:58:08Z")

</div>

you got solution bro

---

<div class="post-metadata">

**Author:** ![virtualyhere](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@virtualyhere](https://forums.unrealengine.com/u/virtualyhere)\
**Post date:** [June 18, 2024, 1:17am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/5 "2024-06-18T01:17:05Z")

</div>

I am facing the same issue still.

---

<div class="post-metadata">

**Author:** ![Readhunterbd1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Readhunterbd1](https://forums.unrealengine.com/u/Readhunterbd1)\
**Post date:** [June 18, 2024, 5:42am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/6 "2024-06-18T05:42:21Z")

</div>

If Anyone Face This PRoblem in unreal 5.4 just replace the AdvertisingPlugin inside runtime with older engine version .For me i repplcae with UE5.2 and it show ad

---

<div class="post-metadata">

**Author:** ![virtualyhere](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@virtualyhere](https://forums.unrealengine.com/u/virtualyhere)\
**Post date:** [June 19, 2024, 3:14am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/7 "2024-06-19T03:14:07Z")

</div>

Are you using Android or IOS? The only plugin I have in Advertising (Runtime) is IOSTapJoy.

---

<div class="post-metadata">

**Author:** ![Readhunterbd1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Readhunterbd1](https://forums.unrealengine.com/u/Readhunterbd1)\
**Post date:** [June 24, 2024, 9:48am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/8 "2024-06-24T09:48:44Z")

</div>

android

---

<div class="post-metadata">

**Author:** ![Lowenmensch](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lowenmensch/32/892317_2.png) [@Lowenmensch](https://forums.unrealengine.com/u/Lowenmensch)\
**Post date:** [June 25, 2024, 1:52am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/9 "2024-06-25T01:52:58Z")

</div>

Try updating the code for the AndroidAdvertising\_APL.xml. It worked for me on version 5.4.2, with both banner and interstitial ads functioning correctly.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/0/b/b0bb3f36f38b35f43ebcd97995e0c699856e1657.png)

My AndroidAdvertising\_APL.xml :  
[AndroidAdvertising\_APL.xml](https://forums.unrealengine.com/uploads/short-url/xIJbuJvvorst6kRJbM67YknbbUo.xml) (13.8 KB)

---

<div class="post-metadata">

**Author:** ![virtualyhere](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@virtualyhere](https://forums.unrealengine.com/u/virtualyhere)\
**Post date:** [June 26, 2024, 6:48pm UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/10 "2024-06-26T18:48:08Z")

</div>

Hi @Lowenmensch,

I followed your instructions and confirm that it now compiles without errors. Thank you!

I still get a bunch of other errors when I submit it to Google Play Console relating to the SDK being old i.e. 18.1.0, instead of 20.0.0+. Any pointers on how to address that?

Again, thank you very much!

---

<div class="post-metadata">

**Author:** ![Lowenmensch](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lowenmensch/32/892317_2.png) [@Lowenmensch](https://forums.unrealengine.com/u/Lowenmensch)\
**Post date:** [June 27, 2024, 2:24am UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/12 "2024-06-27T02:24:16Z")

</div>

> [@Lowenmensch](#):
>
> I’m glad to hear that it now compiles without errors!
> 
> That’s strange about the SDK version errors from Google Play Console because I already updated the dependencies from 18.1.0 to 22.6.0 in the AndroidAdvertising\_APL.xml file I shared. Here’s the section for reference:
> 
> dependencies {  
> implementation(‘com.google.android.gms:play-services-ads:22.6.0’)  
> implementation(‘com.google.android.gms:play-services-ads-lite:22.6.0’)  
> }

I’m glad to hear that it now compiles without errors!

That’s strange about the SDK version errors from Google Play Console because I already updated the dependencies from 18.1.0 to 22.6.0 in the AndroidAdvertising\_APL.xml file I shared. Here’s the section for reference:

dependencies {  
implementation(‘com.google.android.gms:play-services-ads:22.6.0’)  
implementation(‘com.google.android.gms:play-services-ads-lite:22.6.0’)  
}

---

<div class="post-metadata">

**Author:** ![virtualyhere](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@virtualyhere](https://forums.unrealengine.com/u/virtualyhere)\
**Post date:** [June 28, 2024, 6:32pm UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/13 "2024-06-28T18:32:09Z")

</div>

Hi @Lowenmensch,

You are right again. At first, I used a file from a local copy of UE5.2 and it didn’t work. I confirm that once I used your file, the errors went away.

Thanks again!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 28, 2024, 6:33pm UTC](https://forums.unrealengine.com/t/android-packaging-fails-with-errors-in-gameactivity-java/1883300/14 "2024-07-28T18:33:04Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
