Thanks for the quick reply!
However, I’m now unable to compile so I’m probably doing something wrong. When including the raw .java
file through the .unoproj
Includes the project compiled and logged a string, but I guess since I’m now not explicitely including the .uxl
file it is unable to compile?
I hope it’s just something I have forgotten to include and that the fix is relatively simple. I can also create a .jar
of the library to see whether that would work, but then I would first need to know whether these steps are correct.
I’ll include the files I’m using below, minus the MainView as that’s just a button calling the code which works for iOS and local previews
-Project-folder | MainView.ux | mylibrary-release.aar | Message.ccp.uxl | CustomModule.uno | Project-folder.unoproj
Unoproject file:
{
"RootNamespace":"",
"Packages": [
"Fuse.Animations",
"Fuse.BasicTheme",
"Fuse.Themes",
"Fuse.Controls",
"Fuse.Designer",
"Fuse.Drawing",
"Fuse.Drawing.Primitives",
"Fuse.Effects",
"Fuse.Elements",
"Fuse.Entities",
"Fuse.Gestures",
"Fuse.Navigation",
"Fuse.Shapes",
"Fuse.Scripting",
"Fuse.Triggers",
"Fuse.Reactive",
"Fuse.Android",
"Fuse.Desktop",
"Fuse.iOS",
"Fuse.Vibration",
"Fuse.UserEvents",
"FuseCore",
"Uno.Collections",
"Uno.Geometry"
],
"Includes": [
"*",
"IndoorAtlasModule.uno:SourceFile",
]
}
Message.cpp.uxl
<Extensions Backend="CPlusPlus" Condition="Android">
<CopyFile Name="@('mylibrary-release.aar':Path)" TargetName="@(Java.LibsDirectory)/mylibrary-release.aar" />
</Extensions>
CustomModule.uno
using Uno;
using Fuse;
using Fuse.Scripting;
using Fuse.Reactive;
using Uno.Compiler.ExportTargetInterop;
public class CustomModule : NativeModule
{
public CustomModule()
{
AddMember(new NativeFunction("Log", (NativeCallback)Log));
}
public static object Log(Context c, object[] args)
{
string message = (string)args[0];
PrivateLog(message);
return null;
}
[Foreign(Language.Java)]
static extern(ANDROID) void PrivateLog(string msg)
@{
// This is the code I would like to run. It's just a simple log to see whether including aars will work.
nl.rtl.mylibrary.Message.showMessage(msg);
@}
static extern(!ANDROID && !iOS) void PrivateLog(string msg)
{
debug_log(msg);
}
[Foreign(Language.ObjC)]
static extern(iOS) void PrivateLog(string message)
@{
NSLog(@"%@", message);
@}
}