Error wrapping native view

Back to Bug Reports
The issue in this thread has been resolved.
using Uno.Collections;
    using Fuse;
    using Uno;
    using Uno.UX;
    using Uno.Compiler.ExportTargetInterop;
    using Fuse.Controls.Native.Android;
    [Require("AndroidManifest.RootElement", "<uses-feature android:name=\"\"/>")]
    [Require("AndroidManifest.RootElement", "<uses-feature android:name=\"\"/>")]
    [Require("Gradle.Dependency.Compile", "me.dm7.barcodescanner:zbar:1.9")]
    [Require("Gradle.Dependency","compile('me.dm7.barcodescanner:zxing:1.9') { exclude module: 'support-v4' }")]
    [extern(Android) ForeignInclude(Language.Java, "android.content.Intent")]
    [extern(Android) ForeignInclude(Language.Java, "android.util.Log")]
    [extern(Android) ForeignInclude(Language.Java, "net.sourceforge.zbar.Symbol")]
    [extern(Android) ForeignInclude(Language.Java, "com.fuse.Activity")]
    [extern(Android) ForeignInclude(Language.Java, "me.dm7.barcodescanner.zbar.ZBarScannerView")]
    extern(Android) public class AndroidQrScanner : LeafView
        public AndroidQrScanner() : base(Create()){

        static Java.Object Create()
            ZBarScannerView mScannerView = new ZBarScannerView(Activity.getRootActivity());
            return mScannerView;


so im trying to get leafview to work but when i put this in my custom class that inherits from Control i get

C:\Users\kingtech\Documents\Fuse\QrScanner\QrScanner.ux(2,1): Error E8001: Data type not found: AndroidQrScanner
QrScanner.unoproj: E0000: Object reference not set to an instance of an object.
C:\Users\kingtech\Documents\Fuse\QrScanner\QrScanner.unoproj(1,1): Error E0000: Object reference not set to an instance of an object.

my ux markup

<QrView ux:Class="QrScanner">
    <AndroidQrScanner />

QrView is just a basic class inheriting Control

using Uno;
using Uno.UX;
using Fuse.Controls;

    public class QrView : Control

Hi! It looks like you may have ran into the issue described here and here

The currently available workaround (as described in those posts) is to add extern(Android) on the foreign includes

thanks for the reply. I already have it like that, or should be added to the Require tags as well?

Try adding a mocked version of the class with extern(!Android), for example as follows:

    extern(!Android) public class AndroidQrScanner

See the docs where this is mentioned.

Post Stats
  • 6
  • 1182
  • 3
Frequent Posters