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

Hey UE4 friends!

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


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

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.

5 Likes

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?

3 Likes

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

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

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


cd %GRADLEPATH%

before :


subst Z: "%CD%"

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

it works for me.
bye :slight_smile:

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!

Annogen,

With space in path try to put quote :


cd "%GRADLEPATH%"

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


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?

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.

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


> 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 ?

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!

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 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…

11 Likes

I found this solution useful, thank you

Work for me… Thanks

this saved my life!

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