Unity FileNotFoundException "launcherTemplate.gradle" when building for Android - c#

When using Unity 2021.3.6f1 I get a an error saying launcherTemplate.gradle file cannot be found. I don't see it referenced in the project anywhere.
I tried using a custom gradle file, modify existing gradle files but nothing has done the trick so far.
Image
FileNotFoundException: Failed to find $E:/Unity Game Engine/2021.3.6f1/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\GradleTemplates\baseProjectTemplate.gradle
UnityEditor.Android.AndroidBuildPostprocessor.GetTemplate (System.String toolsPath, System.String fileName) (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
UnityEditor.Android.AndroidBuildPostprocessor+<GetDataForBuildProgramFor>d__21.MoveNext () (at <0bc7e9c04c1540528b26863a0cb726ae>:0)
UnityEditor.Modules.BeeBuildPostprocessor.SetupBeeDriver (UnityEditor.Modules.BuildPostProcessArgs args) (at <44a70d1b13cf47e29810e30f45ffae08>:0)
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <44a70d1b13cf47e29810e30f45ffae08>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <44a70d1b13cf47e29810e30f45ffae08>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <44a70d1b13cf47e29810e30f45ffae08>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0bc7e9c04c1540528b26863a0cb726ae>: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 <44a70d1b13cf47e29810e30f45ffae08>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

It looks like it's related to Unity Hub not installing Android build tooling properly.
From https://forum.unity.com/threads/cant-build-quest-game.1307529/
Unity Hub installer neglects to install the tools directory to this path:
c:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\Tools\
Copying over the directory from another recent Unity Editor installation will allow one to make Quest/Android builds again.

Related

Could not load type Readme

I was doing a project using unity and C#, all of a sudden my laptop crashed and after it restarted the project was giving me this error message:
TypeLoadException: Could not load type Readme, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null while decoding custom attribute: (null)
System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) (at <3dd5df5ef4974f29afeb2d3ba227c5da>:0)
System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) (at <3dd5df5ef4974f29afeb2d3ba227c5da>:0)
System.RuntimeType.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) (at <3dd5df5ef4974f29afeb2d3ba227c5da>:0)
UnityEditor.CustomEditorAttributes.Rebuild () (at <8a1c902e1cc24cec8e4dda915647a0cd>:0)
UnityEditor.CustomEditorAttributes.FindCustomEditorTypeByType (System.Type type, System.Boolean multiEdit) (at <8a1c902e1cc24cec8e4dda915647a0cd>:0)
UnityEditor.CustomEditorAttributes.FindCustomEditorType (UnityEngine.Object o, System.Boolean multiEdit) (at <8a1c902e1cc24cec8e4dda915647a0cd>:0)
UnityEditor.SceneView:Awake()
UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String)
UnityEditor.WindowLayout:LoadDefaultWindowPreferences()
The error just keeps repeating on and on and the project was completely fine before the laptop crashed. any solution?
Thank you
After closing Unity, delete the Library, Logs, and obj directories and start Unity again. This is an approach I often take when I have a problem with a Unity project and can't figure out the cause.
This will rebuild the files generated by Unity. It will not affect any code or resources you have added, but if you are concerned, make a copy.

I can't fix "BuildPlayerWindow+BuildMethodException: 3 errors"

I'm newbie to making my own games. months ago I created my first project. Once the build is complete, it builds normally.
But now, suddenly I can't build again because of this error
v
v
v
1
Internal build system error. BuildProgram exited with code -2146233088.
System.Exception: Failed to resolve target API for values
at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.GetPathTargetAPI(NPath path)
at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.EnumerateAPILevelResources(NPath srcAPKResources, NPath dstAPKResources, String resourceName)+MoveNext()
at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.CopyIdsXML(NPath srcAPKResources)+MoveNext()
at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupGradleResources()+MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupPlayerBuild()
at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
at PlayerBuildProgramTypeWrapper.Run(String[] args)
at Program.Main(String[] args)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
2
BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <0d6ce211ebbc47e1a35a84c3672ff58f>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <0d6ce211ebbc47e1a35a84c3672ff58f>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <5160fdea082d4c479eac116da4ffc2de>: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 <0d6ce211ebbc47e1a35a84c3672ff58f>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
3
Build completed with a result of 'Failed' in 41 seconds (40802 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
and this
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <0d6ce211ebbc47e1a35a84c3672ff58f>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <0d6ce211ebbc47e1a35a84c3672ff58f>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
I've been looking for people with the same problem as me. I tried to follow But I can't solve this problem
I did before :
After I encountered a problem I have tried deleting and reinstalling Unity.
I have tried creating a new project. and copy some of the models.
I created an empty projectą¹ƒ
I tried installing another unity version.
But there is no way to solve this problem...

UnityStandaloneFileBrowser: ArgumentException Mono.WebBrowser is referenced by System.Windows.Forms

I imported the UnityStandaloneFileBrowser asset to a sample project to test it. Unfortunately I am not able to build the project for Windows.
I needed to set the Scripting Backend to IL2CPP and tried to use .NET Standard 2.0 and .NET 4.X, but both gave me these errors while trying to build:
1. ArgumentException
ArgumentException: The Assembly Mono.WebBrowser is referenced by System.Windows.Forms ('Assets/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll'). But the dll is not allowed to be included or could not be found.
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
2. UnityEngine.GUIUtility:ProcessEvent
Build completed with a result of 'Failed' in 3 seconds (2740 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
3. UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in <33fb8f3984d146e083d756d969c06738>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <33fb8f3984d146e083d756d969c06738>:0
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
Has anyone an idea, what I can do to fix this?
I contacted the asset developer a few times, but I don't get a response. So you are my last hope :-)

Xamarin.Forms does not compile an Android Project

Again, after updating to VS 8.9.1 on Mac I'm getting this error while trying to compile my Android project:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Tooling.targets(5,5): Error XARSD7023: System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/giulioserra/Library/Android/sdk'.
at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00032] in <36514b14425c4337b446653c547aa9c3>:0
at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x00048] in <36514b14425c4337b446653c547aa9c3>:0
at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <36514b14425c4337b446653c547aa9c3>:0
at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x00042] in <36514b14425c4337b446653c547aa9c3>:0
at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerableFactory.cs:104
at System.IO.Directory.InternalEnumeratePaths (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x00045] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:180
at System.IO.Directory.EnumerateDirectories (System.String path, System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:196
at System.IO.Directory.EnumerateDirectories (System.String path, System.String searchPattern, System.IO.SearchOption searchOption) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:193
at Xamarin.Android.Tools.AndroidSdkBase.FindBestNDK (System.String androidSdkPath) [0x00038] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs:172
at Xamarin.Android.Tools.AndroidSdkBase+<GetAllAvailableAndroidNdks>d__73.MoveNext () [0x000d0] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs:164
at Xamarin.Android.Tools.AndroidSdkBase.GetValidNdkPath (System.String ctorParam) [0x00068] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs:128
at Xamarin.Android.Tools.AndroidSdkBase.Initialize (System.String androidSdkPath, System.String androidNdkPath, System.String javaSdkPath) [0x00061] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs:71
at Xamarin.Android.Tools.AndroidSdkInfo..ctor (System.Action`2[T1,T2] logger, System.String androidSdkPath, System.String androidNdkPath, System.String javaSdkPath) [0x00025] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/AndroidSdkInfo.cs:18
at Xamarin.Android.Tasks.MonoAndroidHelper.RefreshAndroidSdk (System.String sdkPath, System.String ndkPath, System.String javaPath, Microsoft.Build.Utilities.TaskLoggingHelper logHelper) [0x00005] in <e0b267300cf54583bbaa8d3ab5dc4081>:0
at Xamarin.Android.Tasks.ResolveSdks.RunTask () [0x000ac] in <e0b267300cf54583bbaa8d3ab5dc4081>:0
at Xamarin.Android.Tasks.AndroidTask.Execute () [0x00000] in <e0b267300cf54583bbaa8d3ab5dc4081>:0 (XARSD7023) (HangoverBusiness.Android)
I tried to delete bin and obj files but nothing, this problem only manifests in the Android project, while the IOS version works fine.
Env:
Mac OS Catalina
VS 8.9.1
Any hint?
Workaround is now added in prerelease.
https://learn.microsoft.com/en-us/visualstudio/releasenotes/vs2019-mac-preview-relnotes
Workaround:- In some cases, Android projects may fail to build with an error The Java SDK could not be found, please set the path to it in the Xamarin.Android SDKs settings panel. A workaround is to execute the following command in a Terminal:
mkdir -p ~/Library/Android/sdk
Looking at the developer community portal this is a bug introduced in v8.9.1. It also specifies a workaround: manually copy the Android SDK files from the default path (found in the settings screen, see below) to the hardcoded path in the error message. In your case /Users/giulioserra/Library/Android/sdk
A better way for me instead of copying the files is a symbolic link, because I use the Android sdk for multiple applications and users and it takes much disk space.
The symlink solution worked for me:
ln -s /Path/to/real/sdk /Path/from/error/message

Xamarin Binding "Wrapper type '' is missing its native ObjectiveC Class

I am trying to bind an external accessory MSR SDK to Xamarin. Note, this is ON the device. It does not work in the simulator at all. I keep getting this error:
Wrapper type 'iMagProII.IMag' is missing its native ObjectiveC class 'IMag'.
Here is my .cs with my linker flags:
[assembly: LinkWith ("libiMagSDK.a", LinkTarget = LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.Simulator, SmartLink = true, ForceLoad = true, IsCxx = true, Frameworks = "CoreGraphics ExternalAccessory", LinkerFlags="-lsqlite3.0 -lc++")]
Here is the Stack Trace:
at MonoTouch.Registrar.DynamicRegistrar.OnRegisterType (MonoTouch.Registrar.ObjCType type) [0x00334] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.DynamicRegistrar.cs:573
at MonoTouch.Registrar.Registrar.RegisterTypeUnsafe (System.Type type, System.Collections.Generic.List`1& exceptions) [0x009a4] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.Registrar.cs:1027
at MonoTouch.Registrar.Registrar.RegisterType (System.Type type, System.Collections.Generic.List`1& exceptions) [0x00011] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.Registrar.cs:680
at MonoTouch.Registrar.DynamicRegistrar.Register (System.Type type) [0x00002] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.DynamicRegistrar.cs:839
at MonoTouch.ObjCRuntime.Class.Register (System.Type type) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/.pmcs-compat.Class.cs:126
at MonoTouch.ObjCRuntime.Class.GetHandle (System.Type type) [0x00000] in <filename unknown>:0
at MonoTouch.Foundation.NSObject.AllocIfNeeded () [0x00015] in /Developer/MonoTouch/Source/maccore/src/Foundation/.pmcs-compat.NSObject2.cs:390
at MonoTouch.Foundation.NSObject..ctor (MonoTouch.Foundation.NSObjectFlag x) [0x00006] in /Developer/MonoTouch/Source/maccore/src/Foundation/.pmcs-compat.NSObject2.cs:102
at iMagProII.IMag..ctor () [0x00000] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII/obj/Debug/ios/iMagProII/IMag.g.cs:112
at iMagProII.iOS.ImagViewController.ViewDidLoad () [0x0005c] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII.iOS/ImagViewController.cs:46
at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
at MonoTouch.UIKit.UIViewController.get_View () [0x00030] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/.pmcs-compat.UIViewController.g.cs:2232
at iMagProII.iOS.ImagViewController..ctor () [0x00008] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII.iOS/ImagViewController.cs:23
at iMagProII.iOS.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00016] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII.iOS/AppDelegate.cs:33
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/.pmcs-compat.UIApplication.cs:38
at iMagProII.iOS.Application.Main (System.String[] args) [0x00008] in /Users//Projects/Xamarin/Bindings/Unimag/iMagProII.iOS/Main.cs:17
Any help on getting this library bound would be greatly appreciated. I have been banging my head at it for hours now.
This occurs when the class IMag can't be found in the final executable.
The most common reasons for this are:
A typo in the class name.
The native library does not include the architecture you're building for. For instance the native library needs to contain i386 code to run in the simulator. You can use the lipo tool to list the architectures in the native library:
$ lipo -info /path/to/libiMagSDK.a
You also need to know the architecture you're using for the app, you can check this in the project's iOS Build settings, on the Advanced page. Select one that the native library includes.
The native library in the binding project depends on another native library which is not in the binding project (and the IMag class is in that other library). All non-platform dependencies must be included.
The native library is incorrectly built, and doesn't include the class you're trying to bind (this is not frequent, but I've still seen it several times). You can use the nm tool to check what's included in a native library:
$ nm -arch armv7 /path/to/libiMagSDK.a | grep IMag
0x0000f00d S _OBJC_CLASS_$_IMag
[other results]
The above result would indicate that the class is included in the native library.

Categories

Resources