Facing issue on unity3d cmd line - executeMethod class could not be found - c#

I am trying to build a Unity Project targeting Android platform from the cmd line. The C# script to build the project with the required options is titled PerformBuild.cs and is inside the project path. The class contains the method ConfigureBuildTestApp implemented.
$UNITY_PATH/Unity -quit -batchmmode -projectPath "$PROJECT_FINAL_PATH" -logFile -executeMethod PerformBuild.ConfigureBuildTestApp -buildTarget Android
The following error is observed in the build trace
executeMethod class 'PerformBuild' could not be found.
Argument was -executeMethod PerformBuild.ConfigureBuildTestApp
Any solution and/or reasoning for this problem? I followed the forum posts in the unity forum but none was helpful.
The script PerformBuild.cs
Compilation Errors were observed with the script above. Fixed the compilation errors and the revised script is shown below.
Revised PerformBuild.cs
The initial error for -executeMethod is still observed.
executeMethod class 'PerformBuild' could not be found.
Argument was -executeMethod
testIntegrationProject.PerformBuild.ConfigureBuildTestApp
(Filename:
/Users/builduser/buildslave/unity/build/Runtime/Utilities/Argv.cpp
Line: 295)

We had the "executeMethod class could not be found" error when a new plugin was used but was not present in the remote build server, causing all C# code to not compile, hence the error. Try manually building the project on the machine where you are building via command line and see if it succeeds.

Remove the namespace from class PerformBuild

Related

System.Management.Automation.Powershell enable-psremoting is missing pwrshplugin.dll

The following piece of code is from a project of mine that is doing something with PSRemoting. I encountered an issue as the following piece of code
ps.AddScript("enable-psremoting -force -skipnetworkprofilecheck");
await ps.InvokeAsync();
will cause the following error to happen
System.Management.Automation.ActionPreferenceStopException: 'The running command stopped
because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot find path
'C:\Users\pa3ck\Desktop\MP\RemotePowerShell\RemotePowershell\bin\Debug\net6.0-
windows\runtimes\win\lib\net6.0\pwrshplugin.dll' because it does not exist.'
I assume I'm missing some NuGet package, but I have no clue which at this point
I have the following NuGet packages installed and active in the project:
Microsoft.PowerShell.SDK (7.2.7)
Microsoft.WSMan.Management (7.2.7)
Microsoft.WSMan.Runtime (7.2.7)
System.Management.Automation (7.2.7)

com.android.tools.r8.CompilationFailedException

When trying to build my Xamarin project in Visual Studio 2022 I am receiving this error:
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\120\lp\100\jl\bin\classes.jar : com/google/android/gms/measurement/internal/zzai.class
My build log shows this:
Error in obj\Debug\120\lp\100\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class:
Type com.google.android.gms.measurement.internal.zzai is defined multiple times: obj\Debug\120\lp\100\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class, obj\Debug\120\lp\101\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class
I have used 7zip to extract the specified zzai.class file however I don't know what to do from here. Trying to edit the file in notepad++ just shows noninterpretable code.
I fixed the issue by uninstalling unnecessary NuGet packages for Xamarin.GooglePlayServices.Measurement, only keeping the dependent packages required for Xamarin.Firebase.Analytics:
Xamarin.GooglePlayServices.Measurement
Xamarin.GooglePlayServices.Measurement.Api
Xamarin.GooglePlayServices.Measurement.Sdk

Orchard and Visual Studio 2012 command line error

I'm trying to create a new theme in orchard command line but i get an error.
Thank you in advance.
orchard> codegen theme CWSTheme
Error executing command "codegen theme CWSTheme"
None of the constructors found with 'Orchard.Environment.AutofacUtil.DynamicProx
y2.ConstructorFinderWrapper' on type 'Orchard.Security.Authorizer' can be invoke
d with the available services and parameters:
Cannot resolve parameter 'Orchard.Security.IAuthorizationService authorizationSe
rvice' of constructor 'Void .ctor(Orchard.Security.IAuthorizationService, Orchar
d.UI.Notify.INotifier, Orchard.IWorkContextAccessor)'.
Exception Details: Autofac.Core.DependencyResolutionException: None of the const
ructors found with 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFin
derWrapper' on type 'Orchard.Security.Authorizer' can be invoked with the availa
ble services and parameters:
Cannot resolve parameter 'Orchard.Security.IAuthorizationService authorizationSe
rvice' of constructor 'Void .ctor(Orchard.Security.IAuthorizationService, Orchar
d.UI.Notify.INotifier, Orchard.IWorkContextAccessor)'.
Try:
Exit the Orchard Command Line
If you can stop site running on your webserver
In App_Data delete the contents of the dependencies folder (these will get regenerated)
Try the command line again and hopefully all is fixed
If you need to restart the site
I find this often clears up a lot of errors and is the Orchard equivalent of turning it off and on again.

OkHttp binding library for Xamarin Android throwing error

I'm attempting to use the OkHttp-Xamarin library in a Xamarin Android application. Whenever I try to create a new OkHttpNetworkHandler I get the exception below.
Line:
var handler = new OkHttpNetworkHandler();
Throws:
[] Missing method Android.Runtime.JNIEnv::AllocObject(Type) in assembly Mono.Android.dll, referenced in assembly /data/data/com.my.app/files/.__override__/OkHttp.dll
[MonoDroid] UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'Android.Runtime.JNIEnv.AllocObject'.
[MonoDroid] at ModernHttpClient.OkHttpNetworkHandler..ctor () <IL 0x00001, 0x00057>
I am using prebuilt binaries from ModernHttpClient version 0.9. My minimum Android version is set to 2.3 and target is set to 4.2. I'm using Xamarin Studio 4.0.13 and Mono 3.2.3.
So this looks like the first call to your binding code.
A couple things could be going on here:
Make sure you are using EmbeddedJar instead of InputJar as the build action for the jar file. Otherwise, you have to include the jar with your main Android application.
Make sure your main application has a reference to the binding DLL, it causes problems if only a dependent project has the reference.
If neither of those fix your issue, let me know, I think there is a working binding Paul Betts has for this library.
Not really an answer to why the Exception is being thrown but at the suggestion of Paul Betts I switched to the Alpha channel and things are working now.

Issue with Microsoft Enterprise Library 5.0 and custom powershell cmdlet

I'm creating a custom powershell 1.0 cmdlet that will allow me to feed exceptions from powershell scripts to the Microsoft Enterprise Library v5.0 exception handling block.
I load up my Exception handling config from an external file since the cmdlet is compiled into a dll, and then try to create an instance of ExceptionManager using the config.
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource config =
new Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource(configFile);
WriteDebug("Config loaded from " + Path.GetFullPath(configFile));
EnterpriseLibraryContainer.Current = EnterpriseLibraryContainer.CreateDefaultContainer(config);
exManager = EnterpriseLibraryContainer.CreateDefaultContainer(config).GetInstance<ExceptionManager>();
This fails when I call my command from powershell with the following error:
Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type ExceptionManager, key "" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionManager", name = "(none)".
Exception occurred while: while resolving. Exception is: InvalidOperationException - The type ExceptionManager cannot be constructed. You must configure the container to supply this value.
The frustrating thing is that the code works perfectly fine when used in a stand-alone console application with the exact same configuration. I'm not really sure why I'm getting this error; I've made sure that I'm using the same assemblies that are referenced in the config file and I've made sure that I'm referencing all the necessary enterprise library dlls in my project.
Additionally, I've had to copy the Enterprise Library dlls into the powershell install directory (%SystemRoot%\system32\WindowsPowerShell\v1.0), otherwise I would receive FileNotFoundExceptions about not being able to find the correct library while the configuration file was being processed. I don't have too much experience with powershell or enterprise library, but I'm guessing that this might be resolved by playing around with AppDomain settings.
Turns out I wasn't giving an absolute path to my configuration file, which was causing weirdness. I originally just set it to "widgit.dll.config", and threw it under %systemroot%\System32, since that's the default working directory of my powershell, and seemed to get rid of the initial "file not found" errors I was having (didn't want to change the working directory until I understood the entire problem). On a hunch, I copied the config into the powershell directory and renamed it powershell.exe.config, and that solved my other problem.
Putting stuff into system directories isn't the most elegant solution at this point, but it's sufficient for my current problem.

Categories

Resources