Java/Gradle preventing from packaging Android build

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 didn’t had any code in the project, it’s only blueprint based.

Do I miss an sdk ? or something else ?

Thanks for your help.


UATHelper: Packaging (Android (ETC1)): :downloader_library:generateDebugBuildConfig
UATHelper: Packaging (Android (ETC1)): :downloader_library:prepareLintJar
UATHelper: Packaging (Android (ETC1)): :downloader_library:generateDebugSources
UATHelper: Packaging (Android (ETC1)): :downloader_library:javaPreCompileDebug
UATHelper: Packaging (Android (ETC1)): :downloader_library:compileDebugJavaWithJavac
UATHelper: Packaging (Android (ETC1)): :downloader_library:processDebugJavaRes NO-SOURCE
UATHelper: Packaging (Android (ETC1)): :downloader_library:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
UATHelper: Packaging (Android (ETC1)): :app:javaPreCompileDebug

UATHelper: Packaging (Android (ETC1)): Z:\app\src\main\java\com\epicgames\ue4\GameActivity.java:157: error: package com.google.vr.sdk.samples.permission does not exist

UATHelper: Packaging (Android (ETC1)): import com.google.vr.sdk.samples.permission.PermissionHelper;

UATHelper: Packaging (Android (ETC1)): ^
UATHelper: Packaging (Android (ETC1)): 1 error

UATHelper: Packaging (Android (ETC1)): :app:compileDebugJavaWithJavac FAILED

UATHelper: Packaging (Android (ETC1)): FAILURE: Build failed with an exception.

UATHelper: Packaging (Android (ETC1)): * What went wrong:

UATHelper: Packaging (Android (ETC1)): Execution failed for task ‘:app:compileDebugJavaWithJavac’.

UATHelper: Packaging (Android (ETC1)): > Compilation failed; see the compiler error output for details.

UATHelper: Packaging (Android (ETC1)): * Try:
UATHelper: Packaging (Android (ETC1)): Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
UATHelper: Packaging (Android (ETC1)): * Get more help at https://help.gradle.org
UATHelper: Packaging (Android (ETC1)): BUILD FAILED in 45s
UATHelper: Packaging (Android (ETC1)): 38 actionable tasks: 38 executed
UATHelper: Packaging (Android (ETC1)): ERROR: cmd.exe failed with args /c “C:\Users\franc\Documents\Unreal Projects\Sheepdog\Intermediate\Android\APK\gradle\rungradle.bat” :app:assembleDebug
UATHelper: Packaging (Android (ETC1)): (see C:\Users\franc\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.23\Log.txt for full exception trace)
UATHelper: Packaging (Android (ETC1)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ETC1)): BUILD FAILED
PackagingResults: Error: Unknown Error
LogSlate: FSceneViewport::OnFocusLost() reason 0
LogSlate: Took 0.000353 seconds to synchronously load lazily loaded font ‘…/…/…/Engine/Content/Slate/Fonts/DroidSansMono.ttf’ (77K)
LogEditorSessionSummary: EditorSessionSummary sent report. Type=AbnormalShutdown, SessionId={EC3A5B89-47DA-84F4-A83C-AAA803B1EF13}


Plus, when it gets to “UATHelper: Packaging (Android (ETC1)): Z:\app\src\main\java\com\epicgames\ue4\GameActivity.java:157: error: package com.google.vr.sdk.samples.permission does not exist” what I find weird it that I never had a Z:\ hardrive on my computer. I created like a ghost hardrive Z when trying to package.

Z:\ is a virtual hard drive, the real path is [your project]/Intermediate/Build/Android. Check if googe vr plugin is enabled.

Ok, thanks for the info.

Yeah I tried to build with the google VR plugin enabled and disabled and I get the same issue.

Not Solved, for me at least. Any news on this?

Nope. I create another thread on the unreal engine android section of the forum becasue I can’t find any help on this :’(

I managed to solve this in custom 4.24 by modifying Engine\Build\Android\Java\src\com\epicgames\ue4\GameActivity.java.template

remove “import com.google.vr.sdk.samples.permission.PermissionHelper;”
add “import android.Manifest;”

replace permission handling with:
“checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)!=PackageManager.PERMISSION_GRANTED”
and
“checkCallingOrSelfPermission(Manifest.permission.GET_ACCOUNTS)==PackageManager.PERMISSION_GRANTED”

it compiles now, and hopefully works too :smiley:

please find my version of theGameActivity.java.template attached

is this what I should end up with ??

import android.Manifest;

import android.Manifest.checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)!=PackageManager.PERMISSION_GRANTED;

import android.Manifest.checkCallingOrSelfPermission(Manifest.permission.GET_ACCOUNTS)==PackageManager.PERMISSION_GRANTED;

It worked like a charm. Thank you for your help mate. Sending you love <3

WOW! Thanks looking for this for 5 days!

So you did it like this?

import android.Manifest;

import android.Manifest.checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)!=PackageManager.PERMISSION_GRANTED;

import android.Manifest.checkCallingOrSelfPermission(Manifest.permission.GET_ACCOUNTS)==PackageManager.PERMISSION_GRANTED;

If add this to my code i get:
UATHelper: Packaging (Android (ASTC)): Z:\app\src\main\java\com\epicgames\ue4\GameActivity.java:167: error: ‘;’ expected
UATHelper: Packaging (Android (ASTC)): import android.Manifest.checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)!=PackageManager.PERMISSION_GRANTED;
UATHelper: Packaging (Android (ASTC)): ^
UATHelper: Packaging (Android (ASTC)): Z:\app\src\main\java\com\epicgames\ue4\GameActivity.java:169: error: ‘;’ expected
UATHelper: Packaging (Android (ASTC)): import android.Manifest.checkCallingOrSelfPermission(Manifest.permission.GET_ACCOUNTS)==PackageManager.PERMISSION_GRANTED;

Im not sure where should i put the code

Ok sorry now it works. Thank you very much!
It shoud be like this
remove “import com.google.vr.sdk.samples.permission.PermissionHelper;”
add “import android.Manifest;”

And replace
if (!PermissionHelper.checkPermission(“android.permission.WRITE_EXTERNAL_STORAGE”))
{
Log.debug(“android.permission.WRITE_EXTERNAL_STORAGE was not granted; this may cause issues with file access.” );
// we do not do this currently since we must wait until it is granted before accessing files
// SplashActivity takes care of properly gating this in the cases it is needed
//PermissionHelper.acquirePermissions(new String {“android.permission.WRITE_EXTERNAL_STORAGE”}, this);
}

with
if (checkCallingOrSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
Log.debug(“android.permission.WRITE_EXTERNAL_STORAGE was not granted; this may cause issues with file access.” );
// we do not do this currently since we must wait until it is granted before accessing files
// SplashActivity takes care of properly gating this in the cases it is needed
//PermissionHelper.acquirePermissions(new String {“android.permission.WRITE_EXTERNAL_STORAGE”}, this);
}

And
if (PermissionHelper.checkPermission(“android.permission.GET_ACCOUNTS”) && googleClient != null)
{
String email = Plus.AccountApi.getAccountName(googleClient);
Log.debug("GetAccessToken: using email " + email);

			accesstoken = GoogleAuthUtil.getToken(this, email, "oauth2:https://www.googleapis.com/auth/games");
		}

with:

		if (checkCallingOrSelfPermission(Manifest.permission.GET_ACCOUNTS) == PackageManager.PERMISSION_GRANTED) {
			String email = Plus.AccountApi.getAccountName(googleClient);
			Log.debug("GetAccessToken: using email " + email);

			accesstoken = GoogleAuthUtil.getToken(this, email, "oauth2:https://www.googleapis.com/auth/games");
		}

For people who don’t understand at first like I didn’t :smiley:

Thank you very much for providing the solution. It was very helpful.