[mono-android] The GenerateJavaStubs task failed unexpectedly.
Atsushi Eno
atsushieno at veritas-vos-liberabit.com
Thu Jun 7 19:05:18 UTC 2012
Hello,
Could you please try this: we have an example for WebView Javascript
interface in our "monodroid-samples" module
https://github.com/xamarin/monodroid-samples
There is "WebViewJavaScriptInterface" example which is exactly for what
you are trying to do:
https://github.com/xamarin/monodroid-samples/tree/master/WebViewJavaScriptInterface
If this sample builds and works fine, then there is something wrong with
your project file or whatever, not setup. Yet, it could be still our bug
in creating new project files, so in that case it would be nice if you
can file a bug with your reproducible project.
If it results in the same error, it might be platform dependent (I
verified this on Windows7/64bit + VS2010) or some broken setup for the
related assembly or build tools. We would like to know what was your
dev. environment.
Thanks,
Atsushi Eno
On 2012/06/07 15:16, Terry151151 wrote:
> 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 at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
>
More information about the Monodroid
mailing list