I want to build APK in Unity running on Ubuntu, but I’ve got some issues.
I’ve tried the following command:
xvfb-run /opt/Unity/Editor/Unity -quit -nographics -batchmode -projectPath -buildTarget Android -logFile “/opt/build_log.txt”
but got error message:
Aborting batchmode due to failure:
Fatal error! Build target platform ‘Android’ is not a supported build target.
Also I’ve tried do the same programmatically:
BuildPipeline.BuildPlayer(new String[] {"Assets/Untitled.unity"}, "<apk>", BuildTarget.Android, BuildOptions.None);
and run it:
xvfb-run /opt/Unity/Editor/Unity -batchmode -quit -logFile -nographics -projectPath -executeMethod BuildScript.Build --BuildDir <build_dir>
but got the same error:
Exception: Error building Android: Building a player for ‘Android’ (13) target is not supported in this Unity build.
What’s wrong? My Unity version is 5.3.4f1
same issue for my ci-server. where can I get more information about headless build scripts? thanks!
This somewhat misleading error message seems to be related to permissions in Linux
I can run the command locally with my admin account which owns /run/user/1000/pulse etc. but not with the jenkins daemon user (which owns “projectPath”, not sure what the OPs setup is, since he did not specify)
This workaround got it running for me:
-
install a separate jenkins worker on the master (or I guess any machine) running as a normal user account. I used launch with .ssh and set up the worker $home in /var/jenkins/worker/[workername]/… outside of the default /var/lib/jenkins/… but whatever
-
sign in on the physical machine with the normal user
-
launch Unity Editor as that user and open the project, choose File - Build Settings and highlight Android, now exit Unity
-
run
xvfb-run --server-args=“-screen 0 1024x768x24” /opt/Unity/Editor/Unity -batchmode -quit -projectPath /my/project/path -force-opengl -executeMethod MyUnityBuild.Build -logFile
as before, works like magic
I haven’t tried restarting the ci or even signing out of the gui with the normal user, but it would be great if this xvfb pain could be avoided by making Unity more command line centric in whatever way.
Hope that helps.
It’s not about running Unity on ci-server. Also I can’t launch Unity Editor and open project because Unity installed on remote virtual server without any GUI.
I’ve downloaded .deb package of Unity, installed it on remote Ubuntu server and trying to build APK…but looks like I’ve missed something
Same thing. Running in AWS headless no gpu, Audio sent to pulseaudio sink, Video is opengl null mesa driver. Tried with xvfb-run as well obviously no go. Either a limitation by design or misconfigured setings. About 35h of teeth grinding so far.
Exception: BuildPlayer failure: Building a player for 'Android' (13) target is not supported in this Unity build.
EDIT: obviously, unity runs, code compiles, assets compile, compiler exit success, and that happens right before APK output.
EDIT2: Checked both 5.3.4f1 and 5.4.0b16. Personally cannot use confirmed working 5.1.0f3 as lots of references to updated scene manager namespace. Why are linux betas behind on main site? Public web folder with nightly builds or at least auto publish to webfolder with public access would be nice. Community input might be worth it.
did anyone find a solution for this?