How to include .so and .jar files to project

Hi,

I have some of .so and .jar files, you know, an Android SDK. I want to include them to use in my foreign code. How can i do that?

Thanks.

See the documentation on foreign code - should answer your question :slight_smile: https://www.fusetools.com/docs/native-interop/foreign-code#java

Hi Bent.

I believe it does not say how to add .jars or .so libraries directly, only java source files.

I’m missing something?

Thanks.

Hi, josemanuelp

I found how-to and would like to share with you.

First, I made libs folder and copy and paste myjar.jar and myso.so files on this folder.

MyProject
 > libs
    > armeabi
        - myso.so
    > armeabi-v7a
         - myso.so
   - myjar.jar

 - MyProject.uxl
 - MainView.ux
 - MyProject.unoroj

And then make a MyProject.uxl file.

In CopyFile namespace, Name property is the path of libs of your fuse project and ‘TargetName’ is for your destination for Android Studio project.

<Extensions Backend="CPlusPlus" Condition="Android">
    <CopyFile Name="@('libs/myjar':Path)" TargetName="@(Java.LibsDirectory)/myjar.jar" />
    <CopyFile Name="@('libs/armeabi/myso.so':Path)" TargetName="@(Java.LibsDirectory)/armeabi/myso.so" />
    <CopyFile Name="@('libs/armeabi-v7a/myso':Path)" TargetName="@(Java.LibsDirectory)/armeabi-v7a/myso.so" />
</Extensions>

Last, add this MyProject.uxl to uno project setting file(.unoproj) like this for including.

{
  "RootNamespace":"",
  "Packages": [
  	"Fuse",
  	"FuseJS"
  ],
  "Includes": [
    "*", 
    "MyProject.uxl"
  ],
}

I hope this will be help.

Thanks.

Yes, this helped me a lot.

Thanks.