monark
October 2, 2019, 11:23am
1
So I’m finding that if I build an app bundle using Gradle then a load of stuff that works fine in individual apks gets broken. For example Vuforia AR stops detecting AR core being available.
I can build an apk using the internal build system and all checks out fine, ARM64 or ARMv7 or joint doesn’t matter.
I can export a Gradle project and build an apk and that works too.
However in order to publish I’m building signed app bundles and as soon as I do and install via the app store then things stop working, anything that needs a 3rd party library seems to stop functioning.
Is there some trick to building a Gradle project generated from Unity to an app bundle to stop this happening?
Unfortunately building a bundle directly from Unity fails to work so I haven’t been able to test that option.
Everything I tried to fix that has failed.
Did you check the logcat for errors?
Also, what kind of errors you see when exporting app bundle from Unity?
monark
October 3, 2019, 9:11am
3
I’m not seeing any errors in the Pre-launch tests. Just 1 warning about APIs
API Ljava/lang/invoke/MethodHandles$Lookup;->(Ljava/lang/Class;I)V
The error I get building from Unity directly is:
CommandWithNoStdoutInvokationFailure: Gradle initialization failed.
UnityEditor.Android.Command.RunWithShellExecute (System.String command, System.String args, System.String workingdir, System.String errorMsg) (at :0)
UnityEditor.Android.AndroidJavaTools.RunJavaWithShellExecute (System.String args, System.String workingdir, System.String error) (at :0)
UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at :0)
Rethrow as GradleInvokationException: Gradle initialization failed.
UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at :0)
UnityEditor.Android.PostProcessAndroidPlayer+c__AnonStorey0.<>m__0 () (at :0)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <7ba07f088431485bb722f3b3373e87ee>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <7ba07f088431485bb722f3b3373e87ee>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <7ba07f088431485bb722f3b3373e87ee>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <7ba07f088431485bb722f3b3373e87ee>:0)
System.Threading.ThreadHelper.ThreadStart () (at <7ba07f088431485bb722f3b3373e87ee>:0)
UnityEngine.UnhandledExceptionHandler:m__0(Object, UnhandledExceptionEventArgs)
CommandInvokationFailure: Gradle build failed.
/Applications/Unity/Hub/Editor/2018.4.10f1/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/MacOS/bin/java -classpath “/Applications/Unity/Hub/Editor/2018.4.10f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “bundleRelease”
stderr[
FAILURE: Build failed with an exception.
What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
BUILD FAILED in 0s
]
stdout[
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <df45ca7b334d4b918976307f9d26db2e>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action
1[T] progress) (at :0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at :0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
…The sticking out tongue emoji’s are now just taunting me
monark:
I’m not seeing any errors in the Pre-launch tests. Just 1 warning about APIs
API Ljava/lang/invoke/MethodHandles$Lookup;->(Ljava/lang/Class;I)V
The error I get building from Unity directly is:
…The sticking out tongue emoji’s are now just taunting me
Google says, that’s something is locking your cache, search for fileHashes.lock in .gradle\caches\
Try deleting it
monark
October 3, 2019, 12:22pm
5
Creates a new lock file when I build and then seems to give much the same results
CommandWithNoStdoutInvokationFailure: Gradle initialization failed.
UnityEditor.Android.Command.RunWithShellExecute (System.String command, System.String args, System.String workingdir, System.String errorMsg) (at :0)
UnityEditor.Android.AndroidJavaTools.RunJavaWithShellExecute (System.String args, System.String workingdir, System.String error) (at :0)
UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at :0)
Rethrow as GradleInvokationException: Gradle initialization failed.
UnityEditor.Android.GradleWrapper.WarmupGradle (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingDir, System.String baseCommand) (at :0)
UnityEditor.Android.PostProcessAndroidPlayer+c__AnonStorey0.<>m__0 () (at :0)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <7ba07f088431485bb722f3b3373e87ee>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <7ba07f088431485bb722f3b3373e87ee>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <7ba07f088431485bb722f3b3373e87ee>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <7ba07f088431485bb722f3b3373e87ee>:0)
System.Threading.ThreadHelper.ThreadStart () (at <7ba07f088431485bb722f3b3373e87ee>:0)
UnityEngine.UnhandledExceptionHandler:m__0(Object, UnhandledExceptionEventArgs)
CommandInvokationFailure: Gradle build failed.
/Applications/Unity/Hub/Editor/2018.4.10f1/PlaybackEngines/AndroidPlayer/Tools/OpenJDK/MacOS/bin/java -classpath “/Applications/Unity/Hub/Editor/2018.4.10f1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-5.1.1.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “bundleRelease”
stderr[
FAILURE: Build failed with an exception.
What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
BUILD FAILED in 0s
]
stdout[
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <df45ca7b334d4b918976307f9d26db2e>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action
1[T] progress) (at :0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at :0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
monark
October 4, 2019, 11:16am
6
So giving up on bundles until this gets fixed, hopefully Google don’t drop support for apks
Googling “Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory()” from your errors gives me gradle - Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory() - Stack Overflow which says you could be using a wrong java version. Have you followed the setup guide here Unity - Manual: Android environment setup ?
monark
October 9, 2019, 10:33am
8
Unfortunately I’m using 2018.3.14 and these are different instructions to those you posted
These are the ones I followed
https://docs.unity3d.com/2018.3/Documentation/Manual/android-sdksetup.html?_ga=2.222488667.1369058017.1570450803-62453373.1568817120
2018.3.14 doesn’t give me the option to install the Android SDK via the hub