# \[4.21.2\] Android Packaging Error - IsGearVRApplication() is already defined in class GameActivity

**URL:** <https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873>\
**Category:** Mobile\
**Tags:** unreal-engine, Android\
**Created:** [July 18, 2019, 12:33pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873 "2019-07-18T12:33:03Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_Matos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Victor\_Matos](https://forums.unrealengine.com/u/Victor_Matos)\
**Post date:** [July 18, 2019, 12:33pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/1 "2019-07-18T12:33:03Z")

</div>

Hey UE4 friends!

Trying to launch a android project using UE4 4.21.1, but got into this hiccup:

```auto

LogPlayLevel: :app:generateDebugSources
LogPlayLevel: :permission_library:generateDebugSources
LogPlayLevel: Note: Z:\permission_library\src\main\java\com\google\vr\sdk\samples\permission\PermissionFragment.java uses or overrides a deprecated API.
LogPlayLevel: Note: Recompile with -Xlint:deprecation for details.
LogPlayLevel: :permission_library:compileDebugJavaWithJavac
LogPlayLevel: :permission_library:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
LogPlayLevel: :app:javaPreCompileDebug
LogPlayLevel: Error: Z:\app\src\main\java\com\epicgames\ue4\GameActivity.java:590: error: method AndroidThunkJava_IsGearVRApplication() is already defined in class GameActivity
LogPlayLevel: public boolean AndroidThunkJava_IsGearVRApplication()
LogPlayLevel: ^
LogPlayLevel: Note: Some input files use or override a deprecated API.
LogPlayLevel: Note: Recompile with -Xlint:deprecation for details.
LogPlayLevel: 1 error
LogPlayLevel: :app:compileDebugJavaWithJavac FAILED
LogPlayLevel: FAILURE: Build failed with an exception.
LogPlayLevel: * What went wrong:
LogPlayLevel: Execution failed for task ':app:compileDebugJavaWithJavac'.
LogPlayLevel: > Compilation failed; see the compiler error output for details.
LogPlayLevel: * Try:
LogPlayLevel: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
LogPlayLevel: * Get more help at https://help.gradle.org
LogPlayLevel: 59 actionable tasks: 59 executed
LogPlayLevel: BUILD FAILED in 25s
LogPlayLevel: Error: ERROR: cmd.exe failed with args /c "D:\Workspaces\VMatos_TrainingSim\Intermediate/Android/APK\gradle\rungradle.bat" :app:assembleDebug
LogPlayLevel: (see C:\Users\VMatos\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Epic+UE_4.21\Log.txt for full exception trace)
LogPlayLevel: AutomationTool exiting with ExitCode=1 (Error_Unknown)
LogPlayLevel: Completed Launch On Stage: Deploy Task, Time: 45.598880
LogPlayLevel: BUILD FAILED
PackagingResults: Error: Launch failed! Unknown Error
LogPlayLevel: Launcher Device ID: Android_ASTC@FA95PAZ00024
LogPlayLevel: PlayLevel: No blueprints needed recompiling
LogCook: Display: Discovering localized assets
LogCook: Display: Iterative cooking summary for AllDesktop, 

```

At first, I thought it was because I simply needed to update my Android SDK through Codework the android batchfile or that I hadn’t accepted that licensing message on the project settings. Then I thought it was that my environment variables weren’t mapped correctly after the update. At this point, I’m out of ideas and looking to see if any of you wonderful people can help me! I’ve posted images of my settings and by environment variables below!

Thank you!

![Environment-Variables.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/a/6/a640d25f72b1dede3e6fe10793a04b717b9ae748.png)

---

<div class="post-metadata">

**Author:** ![Victor\_Matos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Victor\_Matos](https://forums.unrealengine.com/u/Victor_Matos)\
**Post date:** [July 18, 2019, 3:30pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/2 "2019-07-18T15:30:27Z")

</div>

Bah, just found out it was because I had the WaveVR Plugin on with SteamVR and the Oculus plugin on. Depending on which platform you’re building for (Vivewave for me) make sure the others are disabled.

---

<div class="post-metadata">

**Author:** ![Antek8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Antek8](https://forums.unrealengine.com/u/Antek8)\
**Post date:** [November 28, 2019, 7:53pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/3 "2019-11-28T19:53:35Z")

</div>

HI, I build for Oculus Quest and I have simmilar error:

LogPlayLevel: Error: ERROR: cmd.exe failed with args /c “C:\Users\user\Documents\Unreal Projects\Project\_OQ\Intermediate\Android\APK\gradle\rungradle.bat” :app:assembleDebug

I’ve searched in forums but without good result , any ideas?

---

<div class="post-metadata">

**Author:** ![TheOnlyDoubleF](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheOnlyDoubleF](https://forums.unrealengine.com/u/TheOnlyDoubleF)\
**Post date:** [February 6, 2020, 9:04pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/4 "2020-02-06T21:04:23Z")

</div>

I have the same error but doesn’t seem to be the same cause:

> **[Java/Gradle preventing from packaging Android build](https://forums.unrealengine.com/questions/937278/view.html)**
>
> Hello, I’m trying to make an android build of a project (Android (ETC1) but i’m encountering an error I don’t understand during the packaging. I don’t really know where to look as the solutions I find only talk about adding some code lines. But I...

---

<div class="post-metadata">

**Author:** ![Juanmilanese](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/juanmilanese/32/88709_2.png) [@Juanmilanese](https://forums.unrealengine.com/u/Juanmilanese)\
**Post date:** [February 7, 2020, 3:40pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/5 "2020-02-07T15:40:41Z")

</div>

So you can’t build with gradle. But now Ant is deprecated? so… you can’t build for oculus mobile period?

---

<div class="post-metadata">

**Author:** ![TheOnlyDoubleF](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheOnlyDoubleF](https://forums.unrealengine.com/u/TheOnlyDoubleF)\
**Post date:** [February 7, 2020, 4:09pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/6 "2020-02-07T16:09:42Z")

</div>

> [@Juanmilanese](#):
>
> So you can’t build with gradle. But now Ant is deprecated? so… you can’t build for oculus mobile period?

Don’t know but for example, I’m stuck with the same thing: [https://forums.unrealengine.com/development-discussion/android-development/1718159-android-packaging-error-on-com-google-vr-sdk-samples-permission-and-or-java](https://forums.unrealengine.com/development-discussion/android-development/1718159-android-packaging-error-on-com-google-vr-sdk-samples-permission-and-or-java)

---

<div class="post-metadata">

**Author:** ![NumZer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NumZer](https://forums.unrealengine.com/u/NumZer)\
**Post date:** [February 14, 2020, 5:23am UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/7 "2020-02-14T05:23:09Z")

</div>

Hey,  
I don’t know if it can works for you but when i add this :

```auto

cd %GRADLEPATH%

```

before :

```auto

subst Z: "%CD%"

```

into the file **Unreal4\Epic Games\UnrealEngine\Engine\Intermediate\Android\APK\gradle\rungradle.bat**

it works for me.  
bye 🙂

---

<div class="post-metadata">

**Author:** ![Annogen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Annogen](https://forums.unrealengine.com/u/Annogen)\
**Post date:** [February 14, 2020, 11:18pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/8 "2020-02-14T23:18:35Z")

</div>

NumZer

Like this? It’s not working for me unfortunately

:doneStart  
cd %GRADLEPATH%  
subst Z: “%CD%”  
pushd Z:  
call “%GRADLEPATH%\gradlew.bat” %GRADLE\_CMD\_LINE\_ARGS%  
set GRADLEERROR=%ERRORLEVEL%  
popd  
subst Z: /d  
exit /b %GRADLEERROR%

I keep getting the error “ERROR: cmd.exe failed with args /c “C:\Users ravi\Documents\Unreal Projects\ProoferVRUE 4.24\Intermediate\Android\APK\gradle\rungradle.bat” :app:assembleRelease”

I’ve accepted the SDK license, deleted it, accepted it again, generated a new keystore, just nothing is working for me, Im at wits end, I have a hard deadline in a month and I’m starting to get a bit nervous!

---

<div class="post-metadata">

**Author:** ![NumZer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NumZer](https://forums.unrealengine.com/u/NumZer)\
**Post date:** [February 20, 2020, 2:54pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/9 "2020-02-20T14:54:29Z")

</div>

Annogen,

With space in path try to put quote :

```auto

cd "%GRADLEPATH%"

```

If it doesn’t works, let’s try something :  
open cmd.exe

```auto

cd "C:\Users	ravi\Documents\Unreal Projects\ProoferVRUE 4.24\Intermediate\Android\APK\gradle\"
rungradle.bat :app:assembleRelease

```

is build working or is there an error?

---

<div class="post-metadata">

**Author:** ![Kwixb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kwixb](https://forums.unrealengine.com/u/Kwixb)\
**Post date:** [June 6, 2020, 2:04am UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/10 "2020-06-06T02:04:26Z")

</div>

Getting a similar error when trying to build to quest. It seems to be project specific, since my empty project with the same settings built without error. I’m not sure what to do at this point.

 ![Error.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/1/1/1185aab969a92770520e4622988350ba1d40bfab.png)

---

<div class="post-metadata">

**Author:** ![Fieol](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fieol/32/1104383_2.png) [@Fieol](https://forums.unrealengine.com/u/Fieol)\
**Post date:** [June 19, 2020, 9:18pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/11 "2020-06-19T21:18:13Z")

</div>

Hey! I tried adding your code, but it wasn’t effective, I checked out more information about the bug.

```auto

> Task :app:compileDebugJavaWithJavac
Putting task artifact state for task ':app:compileDebugJavaWithJavac' into context took 0.0 secs.
file or directory 'Z:\app\libs', not found
file or directory 'Z:\app\src\main\libs', not found
file or directory 'Z:\app\src\debug\java', not found
Executing task ':app:compileDebugJavaWithJavac' (up-to-date check took 0.026 secs) due to:
Task has failed previously.
All input files are considered out-of-date for incremental task ':app:compileDebugJavaWithJavac'.
Compiling with source level 1.7 and target level 1.7.
file or directory 'Z:\app\libs', not found
file or directory 'Z:\app\src\main\libs', not found
Creating new cache for classAnalysis, path Z:\.gradle\4.1\javaCompile\classAnalysis.bin, access org.gradle.cache.internal.DefaultCacheAccess@115674e7
Creating new cache for jarAnalysis, path Z:\.gradle\4.1\javaCompile\jarAnalysis.bin, access org.gradle.cache.internal.DefaultCacheAccess@115674e7
Creating new cache for taskJars, path Z:\.gradle\4.1\javaCompile	askJars.bin, access org.gradle.cache.internal.DefaultCacheAccess@115674e7
Creating new cache for taskHistory, path Z:\.gradle\4.1\javaCompile	askHistory.bin, access org.gradle.cache.internal.DefaultCacheAccess@115674e7
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
file or directory 'Z:\app\src\debug\java', not found
Compiling with JDK Java compiler API.
Z:\app\src\main\java\com\epicgames\ue4\GameApplication.java:7: error: cannot find symbol
import android.arch.lifecycle.ProcessLifecycleOwner;
^
symbol: class ProcessLifecycleOwner
location: package android.arch.lifecycle
Z:\app\src\main\java\com\epicgames\ue4\GameApplication.java:22: error: cannot find symbol
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
^
symbol: variable ProcessLifecycleOwner
location: class GameApplication
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

:app:compileDebugJavaWithJavac (Thread[Task worker for ':' Thread 4,5,main]) completed. Took 2.085 secs.

FAILURE: Build failed with an exception.

```

How can I fix it ?

---

<div class="post-metadata">

**Author:** ![Mac3D](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mac3d/32/580444_2.png) [@Mac3D](https://forums.unrealengine.com/u/Mac3D)\
**Post date:** [January 26, 2021, 2:08pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/12 "2021-01-26T14:08:51Z")

</div>

I experience the same errors and several others as you do and the lack of information from Epic as their passivity from their staff trying to tell us where to go from here is dissapointing. I wish I had the answer for you guys but I don´t, hope you managed to fix it!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b011fd3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b011fd3](https://forums.unrealengine.com/u/anonymous_user_2b011fd3)\
**Post date:** [October 11, 2021, 8:16am UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/13 "2021-10-11T08:16:23Z")

</div>

Just had this issue for a couple of days trying to launch on oculus quest, and finally resolved it using info hinted by [Victor\_Matos](https://forums.unrealengine.com/u/Victor_Matos) by disabling the “Oculus VR” plugin.

One of the oculus vr tutorials is likely outdated and instructs developers to “enable Oculus VR plugin”. Being a new dummy, I did just that, not realizing there was already “Oculus OpenXR”, which had a description containing: “…Disable the Oculus VR plugin if you use this”. Lame, RTFM I guess.

Hope this helps someone.  
Also, don’t mind the user name, can’t log into this forum thing for some reason…

 ![obrazek](https://d3kjluh73b9h9o.cloudfront.net/original/3X/3/c/3c27f1a372a954c7373f9171c16f5b786d0fe904.png)

---

<div class="post-metadata">

**Author:** ![Arturogalaxy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Arturogalaxy](https://forums.unrealengine.com/u/Arturogalaxy)\
**Post date:** [November 7, 2021, 3:00pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/14 "2021-11-07T15:00:03Z")

</div>

I found this solution useful, thank you

---

<div class="post-metadata">

**Author:** ![GameEon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GameEon](https://forums.unrealengine.com/u/GameEon)\
**Post date:** [April 24, 2022, 11:32am UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/15 "2022-04-24T11:32:38Z")

</div>

Work for me… Thanks

---

<div class="post-metadata">

**Author:** ![trozt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@trozt](https://forums.unrealengine.com/u/trozt)\
**Post date:** [April 25, 2022, 9:46pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/16 "2022-04-25T21:46:09Z")

</div>

this saved my life!

---

<div class="post-metadata">

**Author:** ![elpro188](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@elpro188](https://forums.unrealengine.com/u/elpro188)\
**Post date:** [August 24, 2023, 3:54pm UTC](https://forums.unrealengine.com/t/4-21-2-android-packaging-error-isgearvrapplication-is-already-defined-in-class-gameactivity/128873/17 "2023-08-24T15:54:25Z")

</div>

If you run into this issue in 5.1 or 5.2 while using Wave VR using the default VRTemplate, disable OpenXR.
