Creating a MonoDevelop application

2019-07-19 15:39发布

问题:

I'm trying to create a Mono-for-Android application in MonoDevelop. I'm on Windows 7 64-bit, and my MonoDevelop version is 2.6 Beta 3.

When I enter an application name and hit the forward button, it gives me the following errors,

  1. File Activity1.cs could not be written.

  2. File Resources could not be written.

  3. File Properties could not be written.

  4. File Assets could not be written.

What's the problem?

Error details for error 1

System.MissingMethodException: Method not found: 'MonoDevelop.Projects.ProjectFile MonoDevelop.Projects.ProjectFileEventArgs.get_ProjectFile()'.

   at MonoDevelop.MonoDroid.MonoDroidProject.OnFileAddedToProject(ProjectFileEventArgs e)

   at MonoDevelop.Projects.Project.NotifyFileAddedToProject(IEnumerable`1 objs)

   at MonoDevelop.Projects.Project.OnItemsAdded(IEnumerable`1 objs)

   at MonoDevelop.Projects.DotNetProject.OnItemsAdded(IEnumerable`1 objs)

   at MonoDevelop.Projects.ProjectItemCollection`1.NotifyAdded(IEnumerable`1 items, Boolean comesFromParent)

   at

    MonoDevelop.Projects.ProjectItemCollection`1.MonoDevelop.Projects.IItemListHandler.InternalAdd(IEnumerable`1 objs, Boolean comesFromParent)

       at MonoDevelop.Projects.ProjectItemCollection`1.NotifyAdded(IEnumerable`1 items, Boolean comesFromParent)

       at MonoDevelop.Projects.ProjectItemCollection`1.OnItemAdded(T item)

       at MonoDevelop.Projects.ItemCollection`1.InsertItem(Int32 index, T item)

       at System.Collections.ObjectModel.Collection`1.Add(T item)

       at MonoDevelop.Projects.Project.AddFile(String filename, String buildAction)

       at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddFileToProject(SolutionItem policyParent, Project project, String language, String directory, String name)

       at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddToProject(SolutionItem policyParent, Project project, String language, String directory, String name)

       at MonoDevelop.Ide.Templates.ProjectDescriptor.InitializeItem(SolutionItem policyParent, ProjectCreateInformation projectCreateInformation, String defaultLanguage, SolutionEntityItem item)

Get similar details for other errors.

This is what I get when I install the AddIn:

Also when I hit Tools>Options>Other>Mono for Android SDK's, I get the following error(and error details) in a pop-up

Un-handled exception

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified.

   at MonoDevelop.MonoDroid.Gui.MonoDroidSdkSettingsWidget.Build()

   at MonoDevelop.MonoDroid.Gui.MonoDroidSdkSettingsWidget..ctor()

   at MonoDevelop.MonoDroid.Gui.MonoDroidSdkSettings.CreatePanelWidget()

   at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.CreatePageWidget(SectionPage page)

   at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.ShowPage(OptionsDialogSection section)

   at MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.OnSelectionChanged(Object s, EventArgs a)

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)

   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

   at System.Delegate.DynamicInvokeImpl(Object[] args)

   at GLib.Signal.ClosureInvokedCB(Object o, ClosureInvokedArgs args)

   at GLib.SignalClosure.Invoke(ClosureInvokedArgs args)

   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)

回答1:

I ran into the same error and found a solution by seeing Daniel Soto's answer to Error creating Android app. Basically, install the 2.5.90.3 trunk build of MonoDevelop here.

I was able to continue.



回答2:

Somehow you have a version of the Mono for Android addin that doesn't match your MonoDevelop version. Try updating MD to 2.6 b2 and then update the addin through the addin manager.