I've been banging my head against the wall the last 6 days or so trying to get Unity to build my Android game.
My game used to build as it should a few months back, I had a couple new things I came up with and added those (the game runs fine within Unity, there are no errors in play mode).
Trying to build my game with the C++ compiler set to the 'master', however, consistently fails, with the following exceptions:
1.
Building Library\Bee\artifacts\Android\fy9m9\libil2cpp.so failed with output:
C:/Program Files/Unity/Hub/Editor/2021.3.14f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin\ld.gold.exe: internal error in arm_branch_common, at /buildbot/src/android/binutils/toolchain/binutils/binutils-2.27/gold/arm.cc:4063
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <6a5b55f2e18b419e9faedac06ac6af94>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <6a5b55f2e18b419e9faedac06ac6af94>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <b5a1f7b6d39d4ca78ca284153b2ea92d>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <6a5b55f2e18b419e9faedac06ac6af94>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Build completed with a result of 'Failed' in 668 seconds (667590 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <6a5b55f2e18b419e9faedac06ac6af94>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <6a5b55f2e18b419e9faedac06ac6af94>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Things I've tried so far:
Building with the C++ Compiler Configuration set to 'release' also compiles
I can build the project if I switch the platform to Windows
It seems the project can build if I set the compiler to 'debug' instead of 'master', this does not solve the problem, but might be a clue to the actual problem(?)
Making sure it was not caused by something I added: I loaded up the backup of my game (version 1.0, which worked fine and is also published), but the backup can also no longer be build.
Making sure the problem is not with Unity itself, I tried to do a build of a clean project. This works as expected.
I updated all packages in my project
I updated the Unity version my project uses to 2021.3.14f1 (which I also use for another Android project, which can be build with that version).
Updated the Google Play Games for Unity Plugin (https://github.com/playgameservices/play-games-plugin-for-unity) and accompanying code changes that were required
Per response on Reddit, I made sure that no script uses the UnityEditor namespace (the few that do, are put with #IF UNITY_EDITOR commands
Thanks to user jdweng I managed to find the problem by looking at it from a different angle. Which led me to a post on the Unity Forums with someone who has the exact same problem I described: https://forum.unity.com/threads/fails-to-compile-on-android-arm-32.1135633/
One user there mentions a solution (credits to pradotech), which ended up fixing the problem for me:
I could build for Android using Master compiler after changing
Stripping Level to Medium (I was using Low) and switching from .NET
Framework to .NET Standard 2.1. Details below:
Unity 2021.3.9f1
Faster runtime
Compression: LZ4HC API
Compatibility: .NET Standard 2.1
Compiler Configuration: Master
All architectures (ARMv7, ARM64, x86 and x86-64)
Managed Stripping Level: Medium/High
I also removed some unused scripts from project.
Build completed without any errors.
Hope it keeps working and maybe that helps someone.
My project is using Unity 2021.3.14f1, I was already on .Net Standard 2.1.
I changed stripping to Medium, removed a bunch of deprecated scripts and now it works again.
Related
I've made a C# console application which compiles with mono (mcs) and I can run that on both Windows and Raspberry Pi (raspbian). The application uses the NuGet package Vlc.DotNet.Core to interface with the VLC installation that exists on my Windows machine, and this works.
I know the path to libvlc.dll (which the api requires in order to work) on my Windows machine, the problem is that I can't find that on the Raspberry Pi even after installing VLC on there with apt-get install vlc.
I've searched the Pi for the location of vlc, and entered that path into the constructor of VlcMediaPlayer as follows;
new VlcMediaPlayer(new DirectoryInfo("/usr/lib/arm-linux-gnueabihf/vlc"));
I have very little confidence that I've used the correct path... Clearly there are major differences between VLC's Windows installation and the one for Raspbian.
The resulting exception on the Pi reads:
Unhandled Exception:
System.IO.FileNotFoundException: Unable to find the specified file.
at Vlc.DotNet.Core.Interops.VlcLibraryLoader..ctor (System.IO.DirectoryInfo dynamicLinkLibrariesPath) [0x0007a] in <baf298be89ec4e8f88b59dde806086ea>:0
at Vlc.DotNet.Core.Interops.VlcLibraryLoader.GetOrCreateLoader (System.IO.DirectoryInfo dynamicLinkLibrariesPath) [0x00051] in <baf298be89ec4e8f88b59dde806086ea>:0
at Vlc.DotNet.Core.Interops.VlcManager..ctor (System.IO.DirectoryInfo dynamicLinkLibrariesPath, System.String[] args) [0x00006] in <baf298be89ec4e8f88b59dde806086ea>:0
at Vlc.DotNet.Core.VlcMediaPlayer..ctor (System.IO.DirectoryInfo vlcLibDirectory) [0x00000] in <9af967e78de14038abf8c3386a2b8049>:0
at MonoApp.Classes.VLCFactory.Create () [0x0000b] in <0b03f50fed2542db8a444bf356ef64b6>:0
at MonoApp.Classes.VLCCommands.VLCCommand_Play.Execute (Vlc.DotNet.Core.VlcMediaPlayer& mediaPlayer, System.String[] args) [0x00007] in <0b03f50fed2542db8a444bf356ef64b6>:0
at MonoApp.Program.Main (System.String[] args) [0x00019] in <0b03f50fed2542db8a444bf356ef64b6>:0
EDIT:
I've found the source files to the VlcLibraryLoader class (as seen in the exception) here, and apparently it's looking for three dlls, only two of which exist on Windows so I'm guessing that the linked source files are slightly outdated. The point here is that they're looking for .dll files, not the .so files that exist on the Raspberry Pi, so I'm not surprised it's failing. The question remains, however...
QUESTION:
Am I using the correct vlc package libvlc-dev, are there any other dependencies I need?
Is Vlc.DotNet.Core API known to work on Raspbian with mono or am I on a hopeless path?
I don't know if Vlc.DotNet.Core can be made to work on raspbian with mono. It is initially targetted to work on Windows, as you know.
LibVLCSharp probably will work on raspbian though, since it works with ubuntu.
LibVLC/GTK linux install guide: https://code.videolan.org/videolan/LibVLCSharp/blob/master/docs/linux-setup.md
LibVLCSharp.GTK sample: https://code.videolan.org/videolan/LibVLCSharp/tree/master/Samples/LibVLCSharp.GTK.Sample
Good luck.
I'm trying to "build" a game project made on Unity3D, but keep getting errors unrelated to the code; as far as I understand.
Unity 3D version 2018.3.0f2
MacBook Pro, MacOS Mojave v. 10.14.2
The game runs fine on this and two other devices which run a Windows 10 OS. It builds without problems on the Windows OS, but not on the MacOS.
The project is the exact same; copied via flash-drive to transfer between the two, and pulled as a git project.
I have tried installing Unity3D via the install assistant, and via Unity Hub; neither made a difference.
I made sure all required dependencies were installed, and re-installed multiple times. Clean installs, restarts, even the OS was re-installed as I had literally just gotten this laptop to work on my Unity game-dev projects.
After many failed attempts, I made a partitioned drive specifically for this project, re installed everything and ran the project for the firs time. Test played it, it ran well, but still wouldn't build. I did that because I thought it was a security or "access rights" problem.
With that, I even allowed Unity access to the whole drive via the security settings of the Mac OS.
[1] https://imgur.com/q4prwXh "Error Screenshot".
What was expected was that the project would build without problems; what happened was that I got these errors which I will try to post a picture of.
The error in text in-case screenshot doesn't work:
[1]
UnauthorizedAccessException: Access to the path "/Volumes/(edited >out)/Temp/StagingArea/Data/Managed/Unity.Analytics.StandardEvents.dll" >is denied.
System.IO.File.Delete (System.String path) (at :0)
UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (System.Collections.IEnumerable assemblies, System.String managedAssemblyFolderPath, System.String[] assembliesToStrip, System.String[] searchDirs, System.String monoLinkerPath, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:372)
UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String managedAssemblyFolderPath, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:216)
UnityEditorInternal.IL2CPPBuilder.Run () (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:203)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:42)
DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet1[T] filesToNotOverwrite) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:245)
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:46)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
[2]
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00234] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:190
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:96
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Thank you for the help.
If anyone has problems building their Unity3D project on a Mac, I may have found a solution for my problem that could help others.
Two things, one of which may have been the cause of it.
1) I basically ran the Packages Manager within Unity, and removed all packages that were initially added via the Windows version of Unity3D (for Android). I don't know much about this part, but that worked.
2) You need to download and install the latest Xcode from the AppStore, run it with template project (something to make it run and start up); that way it downloads any dependencies or required files. Then, close project, restart the computer, and once back; run your Unity3D project and try building again.
That basically fixed it for me, as there were certain files in the project that needed some "access rights" that were not possible without Xcode being there and installed; which, I think, allows those things to happen.
I hope that helps others.
Best of luck.
I am trying to build an APK (for Android) in Unity 2017, but get a strange build error.
Here are what I have done:
(1) I have already imported Unity IAP, and have verified that the lib Store.dll actually exists inside the folder "Assets/Plugins/UnityPurchasing/Bin/Stores.dll"
(2) I have changed the Build Settings > Player Settings > API Compatibility Level to Net 2.0.
However, I still have this build error:
ArgumentException: The Assembly UnityEngine.Purchasing is referenced by Stores ('Assets/Plugins/UnityPurchasing/Bin/Stores.dll'). But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary2 cache, BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:156)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at /Users/builduser/buildslave/unity/build/Editor/Mono/AssemblyHelper.cs:196)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Please let me know how to fix this build error. Thanks.
I have solved this issue.
Basically, I need to ENABLE the IAP purchase option as follow: Go to the Unity menu bar -> Click on Window -> Services -> In App Purchase -> Enable.
After that, the build works fine.
--
PS: I was switching projects a few times and forgot to re-enable the IAP in the new project. That was the reason for this bug to show up.
I can't build another APK in Unity. Always the same error.
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_171\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'gradleOut'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 27.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED in 1s
]
stdout[
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\m-pro\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Checking the license for package Android SDK Build-Tools 27.0.1 in C:\Users\m-pro\AppData\Local\Android\Sdk\licenses
Warning: License for package Android SDK Build-Tools 27.0.1 not accepted.
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
My settings and things I've tried:
JDK version 1.8
SDK build tool version 25
I tried to copy "-dontwarn com.google.vr.ndk.base.DaydreamApi" into a proguard file (saw this type of a solution somewhere)
Swap from gradle build to internal build (as internal build a different error comes up)
Reinstall all and restart my computer :D
I had this same issue with my Unity builds after the build tools got an update, so you may just have to update them too.
as it says in the error message you need to accept the TOS using android studio
You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 27.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Install Android studio on your PC (if you havn't already)
run its SDK manager (configure > SDK manager > SDK tools)
If Android SDK build-tools says "Not installed", click the checkbox right next to it to install it.
if It says "Update available" click the checkbox with the "-" next to it so it shows a "✓"
hit apply, and accept the agreement.
That is what fixed it for me, hope this also works for you!
On OSX, I ran into this after upgrading from Unity 2020.3.24f1 to Unity 2020.3.38f1
What fixed it for me was getting the JDK and SDK paths from the Unity/Preferences/external tools, then in a terminal window:
export JAVA_HOME=<the JDK path Unity is using>
<SDK path Unity is using>/tools/bin/sdkmanager --licenses
for me this was:
export JAVA_HOME=/Applications/Unity/Hub/Editor/2020.3.38f1/PlaybackEngines/AndroidPlayer/OpenJDK
/Applications/Unity/Hub/Editor/2020.3.38f1//PlaybackEngines/AndroidPlayer/SDK/tools/bin/sdkmanager --licenses
This will then prompt to accept several licenses which appear under
/Applications/Unity/Hub/Editor/2020.3.38f1/PlaybackEngines/AndroidPlayer/SDK/licenses
Without the export JAVA_HOME to Unity's version, the sdkmanager --licenses would fail with a Java error.
After I figured this out on my own, I happened to notice the solution in Unity forums as well here: https://forum.unity.com/threads/gradle-build-faled.999773/
I am using Visual Studio Code to develop an ASP.NET 5 application on Mac. The issue I am having is that I don't get any IntelliSense support (e.g. available class methods) beyond simple autocomplete for methods and variables names that I previously typed.
The app targets DNX Core 5.0:
"frameworks": {
"dnxcore50": { }
},
And I have CoreCLR 1.0.0-rc1-update1 installed via DNVM:
$dnvm list
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-update1 coreclr x64 darwin default
I tried the following to resolve the issue, but with no luck:
Made sure that a project is selected (fire icon in the bottom right corner)
Explicitly turned suggestions in settings.json
{
"editor.quickSuggestions": true`
}
Any suggestions will be much appreciated.
In short, the problem was that, while I had Mono installed on my machine, I didn't have DNX Mono. Installing it via DNVM locally (dnvm upgrade -r mono) resolved the issue and now I am having nice IntelliSense support in Visual Studio Code.
Now the long story.
Visual Studio Code uses OmniSharp to provide IntelliSense support. OmniSharp is a set of tools that provides C# code analysis services through a Nancy-based web API that runs on your machine (great posts on it here and here).
I didn't not get any IntelliSense because OmniSharp ran with errors which I could have easily caught if I paid more attention to Visual Studio Code Output window (Cmd+L L on Mac). OmniSharp Log (see below) shows that it tried to use dnx-mono.1.0.0-rc1-update1 runtime and then threw an exception because it was not there.
From what I understand, OmniSharp can't use DNX CoreCLR (because it doesn't support sockets?) and needs DNX Mono to run. There is some discussion on this topic in VS Code GitHub repo here.
Running dnvm upgrade -r mono and restarting Visual Studio Code fixed the issue. My DNVM set up now looks like this:
Please note that you don't have to use DNX Mono for development in order to get IntelliSense to work. You just need to have it installed.
OmniSharp Log
[INFO] Starting OmniSharp at APP_PATH...
[INFO] Started OmniSharp from '/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/jrieken.vscode-omnisharp/bin/omnisharp' with process id 34893...
[INFORMATION:OmniSharp.Startup] Omnisharp server running using stdio at location APP_PATH on host 34884.
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Scanning APP_PATH for DNX projects
[INFORMATION:OmniSharp.Dnx.DnxPaths] Using runtime '/Users/nsamteladze/.dnx/runtimes/dnx-coreclr-darwin-x64.1.0.0-rc1-update1'.
[INFORMATION:OmniSharp.Dnx.DnxProjectSystem] Found project APP_PATH/project.json.
[INFORMATION:OmniSharp.Dnx.DesignTimeHostManager] Using '/Users/nsamteladze/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1' for design time host.
[ERROR:OmniSharp.Startup] The project system 'DnxProjectSystem' threw an exception.
System.InvalidOperationException: File name has not been set
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in :0
at System.Diagnostics.Process.Start () [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()
at OmniSharp.Dnx.DesignTimeHostManager.Start (System.String hostId, System.Action`1 onConnected) [0x00000] in :0
at OmniSharp.Dnx.DnxProjectSystem.Initalize (IConfiguration configuration) [0x00000] in :0
at OmniSharp.Startup.Configure (IApplicationBuilder app, IServiceProvider serviceProvider, ILibraryManager manager, IOmnisharpEnvironment env, ILoggerFactory loggerFactory, ISharedTextWriter writer, IOptions'1 optionsAccessor) [0x00000] in :0
[INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] No solution files found in APP_PATH
[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Detecting CSX files in APP_PATH.
[INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Solution has finished loading