Error wrapping native view


#1
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=\"android.hardware.camera\"/>")]
	[Require("AndroidManifest.RootElement", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>")]
	[Require("Gradle.Dependency.Compile", "me.dm7.barcodescanner:zbar:1.9")]
	[Require("Gradle.Dependency","compile('me.dm7.barcodescanner:zxing:1.9') { exclude module: 'support-v4' }")]
	[Require("Gradle.Repository","mavenCentral()")]
	[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
	{
        
		[UXConstructor]
		public AndroidQrScanner() : base(Create()){
			
		}
	

		[Foreign(Language.Java)]
		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>

QrView is just a basic class inheriting Control

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


    public class QrView : Control
    {
       
    }


#2

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


#3

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


#4

Oops, sorry, I didn’t notice that. I’ll pass it on internally then.


#5

thanks much


#6

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.


#7

Olle Fredriksson wrote:

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.

thanks that worked for me. Could you also check out this thread for me https://www.fusetools.com/community/forums/general/cameraview_in_nativeviewhost ?