Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

trouble with xamarin android compilation

$
0
0

A cursory search for this on google did not return any results, so feel free to point me towards anyone else having the same issue.

So I am trying to export an object through the javascript interface to a webview component. One of my objects works fine, another fails to compile.

The one that fails is defined as such:

public class ModelRepoWrapper : Java.Lang.Object {

            private ModelRepository repo;

            public ModelRepoWrapper(ModelRepository repo) {

                this.repo = repo;

            }

            [Export("set")]
            [JavascriptInterface]
            public void set(string name, BaseModel model) {
                repo.set(name, model);
            }

            [Export("get")]
            [JavascriptInterface]
            public object get(string name) {
                return (object)repo.get<BaseModel>(name);
            }
        }

On build, the compiler is throwing the following error:

Error 47 Failed to create JavaTypeInfo for class: myandroid.ModelRepoWrapper due to System.NullReferenceException: Object reference not set to an instance of an object. at Xamarin.Android.Tasks.JavaTypeInfo.Signature..ctor(String name, String signature, String connector, String managedParameters, String outerType, String superCall) at Xamarin.Android.Tasks.JavaTypeInfo.Signature..ctor(MethodDefinition method, ExportAttribute export) at Xamarin.Android.Tasks.JavaTypeInfo.AddMethod(MethodDefinition registeredMethod, MethodDefinition implementedMethod) at Xamarin.Android.Tasks.JavaTypeInfo..ctor(TypeDefinition type, String outerType, Object log) at Xamarin.Android.Tasks.JavaTypeInfo..ctor(TypeDefinition type, Object log) at Xamarin.Android.Tasks.Generator.GenerateJavaSource(TaskLoggingHelper log, TypeDefinition t, String outputPath, Boolean useSharedRuntime, Boolean hasExportReference)

Obviously I am doing something wrong, but I'm not really clear on what.. Any thoughts?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>