Java Question Seeking Assistance with Simple Compiler in B4A: Can Anyone Guide Me?

Johan Schoeman

Expert
Licensed User
Longtime User
You might have to change the wrapper to load the chilkat .so libraries

B4X:
public class chilkatWrapper  {


    private BA ba;
    private String eventName;
    private CkCrypt2 crypt;
    
    

    public void Initialize(BA ba, String EventName) {
        this.eventName = EventName.toLowerCase(BA.cul);
        this.ba = ba;
        crypt = new CkCrypt2();
    }
    
    
    static {
        System.loadLibrary("chilkat");
    }
 

carlos7000

Well-Known Member
Licensed User
Longtime User
View attachment 155040



B4X:
package chilkatwapper;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.ViewGroup;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.Hide;
import anywheresoftware.b4a.BA.Pixel;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.keywords.Common.DesignerCustomView;
import anywheresoftware.b4a.objects.LabelWrapper;
import anywheresoftware.b4a.objects.PanelWrapper;
import anywheresoftware.b4a.objects.ViewWrapper;
import anywheresoftware.b4a.BA.ActivityObject;

import anywheresoftware.b4a.BA.Events;

import android.os.Bundle;


import com.chilkatsoft.*;

//@ActivityObject
//@Events(values={"picture_changed(position As Int), scroll_stopped(), picture_touched(position As Int), picture_long_touched(position As Int)"})
//@Author("Github: Antonio081014, Wrapped by: Johan Schoeman")
@Version(1.00f)
@ShortName("Chilkat01")
//@DependsOn(values={"android-support-v4"})
public class chilkatWrapper  {


    private BA ba;
    private String eventName;
    private CkCrypt2 crypt;
   
   

    public void Initialize(BA ba, String EventName) {
        this.eventName = EventName.toLowerCase(BA.cul);
        this.ba = ba;
        crypt = new CkCrypt2();
    }


/*     public String sign(String privateKey, String message) {
        return ed25519.signStringENC(privateKey, message);
    }    private CkEd25519 ed25519;



    public String sign(String privateKey, String message) {
        return ed25519.signStringENC(privateKey, message);
    }         */
       


 
}

Recreate the structure and copy the files as you will see in the screenshots.

Capture.PNG


*.so files in your folders:

Capture 5.PNG
Capture 6.PNG
Capture 7.PNG
Capture 8.PNG


Compiling...

Capture 2.PNG


When trying to use the library:

Capture 3.PNG


Displaying the contents of the "Additional Libraries" folder

Capture 2.PNG

I thank you very much for your help. I wonder if it's not easier to make a wrapper from the eddsa-0.3.0.jar library.
 

carlos7000

Well-Known Member
Licensed User
Longtime User
See the folder structure in the attached. I have removed the .so files from their folder else too big to upload. Put the .so files back in their folders before trying to compile with SLC

I see no class in the java project with a name of CkEd25519.......?

import com.chilkatsoft.CkEd25519;

Where did you get this class from?

I didn't write that file. Copilot created it
 

carlos7000

Well-Known Member
Licensed User
Longtime User
View attachment 155040



B4X:
package chilkatwapper;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.ViewGroup;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.Hide;
import anywheresoftware.b4a.BA.Pixel;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.keywords.Common.DesignerCustomView;
import anywheresoftware.b4a.objects.LabelWrapper;
import anywheresoftware.b4a.objects.PanelWrapper;
import anywheresoftware.b4a.objects.ViewWrapper;
import anywheresoftware.b4a.BA.ActivityObject;

import anywheresoftware.b4a.BA.Events;

import android.os.Bundle;


import com.chilkatsoft.*;

//@ActivityObject
//@Events(values={"picture_changed(position As Int), scroll_stopped(), picture_touched(position As Int), picture_long_touched(position As Int)"})
//@Author("Github: Antonio081014, Wrapped by: Johan Schoeman")
@Version(1.00f)
@ShortName("Chilkat01")
//@DependsOn(values={"android-support-v4"})
public class chilkatWrapper  {


    private BA ba;
    private String eventName;
    private CkCrypt2 crypt;
   
   

    public void Initialize(BA ba, String EventName) {
        this.eventName = EventName.toLowerCase(BA.cul);
        this.ba = ba;
        crypt = new CkCrypt2();
    }


/*     public String sign(String privateKey, String message) {
        return ed25519.signStringENC(privateKey, message);
    }    private CkEd25519 ed25519;



    public String sign(String privateKey, String message) {
        return ed25519.signStringENC(privateKey, message);
    }         */
       


 
}

I have made another attempt:

Capture.PNG
 

Johan Schoeman

Expert
Licensed User
Longtime User

carlos7000

Well-Known Member
Licensed User
Longtime User
Put......
com.
....in the -b4aignore field of SLC and compile again. The refresh libs in your project and see if it solves the issue.

I hereby inform you that I successfully recompiled the library. The steps I followed were as follows:
  1. I removed the old library.
  2. I recompiled it.
  3. Following your last recommendation.
  4. B4A did not display any alert messages.
I’ve attached screenshots for clarity.

Capture.PNG


However, when attempting to use the library, no functions or methods appear.

Capture 2.PNG
Capture3.PNG
Capture4.PNG


Thank you for your assistance!
 

Johan Schoeman

Expert
Licensed User
Longtime User
I hereby inform you that I successfully recompiled the library. The steps I followed were as follows:
  1. I removed the old library.
  2. I recompiled it.
  3. Following your last recommendation.
  4. B4A did not display any alert messages.
I’ve attached screenshots for clarity.

View attachment 155095

However, when attempting to use the library, no functions or methods appear.

View attachment 155096 View attachment 155097 View attachment 155098

Thank you for your assistance!
I have only added an Initialize in the wrapper. Leaving it up to you to now build the other methods in the wrapper.
 
Top