I'm trying to create a JavaScript interface for use with a WebView.
I created the class below and used it as shown. I have also added a
reference to Mono.Android.Export to the project.

When I compile I get the error Shown further below.


using Java.Interop;
namespace Common
{
        public class JavaScriptInterface : Java.Lang.Object
        {
                [Export]
                public void Test()
                {
                }
        }
}

_webView.AddJavascriptInterface( new JavaScriptInterface(), "Device" );


Error   1       The "GenerateJavaStubs" task failed unexpectedly.
System.ApplicationException: Failed to create JavaTypeInfo for class:
Common.JavaInterface ---> System.InvalidOperationException: You need to add
a reference to Mono.Android.Export.dll when you use ExportAttribute or
ExportFieldAttribute.
   at Xamarin.Android.Tasks.Generator.CreateJavaSources(List`1 javaTypes,
String outputPath, Boolean useSharedRuntime, Boolean hasExportReference)
   --- End of inner exception stack trace ---
   at Xamarin.Android.Tasks.Generator.CreateJavaSources(List`1 javaTypes,
String outputPath, Boolean useSharedRuntime, Boolean hasExportReference)
   at Xamarin.Android.Tasks.GenerateJavaStubs.Execute()
   at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at
Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost
taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost,
ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
PeerlessRepSalesV2


--
View this message in context: 
http://mono-for-android.1047100.n5.nabble.com/The-GenerateJavaStubs-task-failed-unexpectedly-tp5710209.html
Sent from the Mono for Android mailing list archive at Nabble.com.
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to