Java Question Simple Library Compiler can't find AndroidX packages

Hello, I'm trying to wrap a library, but when I try to compile it with Simple Library Compiler it says that it cant find the AndroidX packages that the library uses. However when I add let's say for example the androidx-core classes.jar to the libs folder it proceeds to the next package. The problem is that the library I'm wrapping depends on about 25 AndroidX packages and it's quiet annoying to add each one to the libs folder. Is there another way I can make simple library compiler find the needed dependencies or I have to add them manually to the libs folder ?

Simple Library Compiler Log:
Starting step: Compiling Java code.
D:\Development\Projects\sly_calendar_library_wrapper\app\src\main\java\com\example\slycalendarlibrarywrapper\MainActivity.java:3: error: package androidx.appcompat.app does not exist
import androidx.appcompat.app.AppCompatActivity;
                             ^
1 error

javac 11.0.1

Error.

Also I don't know if this has anything to do with my problem but I can see all the required packages inside extras/b4a_remote/androidx
 

DonManfred

Expert
Licensed User
Longtime User
The problem is that the library I'm wrapping depends on about 25 AndroidX packages and it's quiet annoying to add each one to the libs folder
You need to do it. You also can create a batch file which does extract all the classes.jars from the artifacts. But you need to extract them.

MainActivity.java
It is a mistake to try to wrap a library which is extending any Object like appcompat. Or Activities.
Do not wrap activities.
 
Thanks for the answer, I will just add them to the libs folder, It's not a big problem.

The reason i use activity is that the library I'm wrapping is a dialog, can't really say if what I'm doing here is actually called "wrapping" because all I'm trying to compile is a method that calls the show() method from the library.

Java Code (This is what I try to compile):
public class Activity extends AppCompatActivity implements SlyCalendarDialog.Callback {

    private BA ba;
    private String eventName;

    public void Initialize(final BA ba, final String eventName) {
        this.ba = ba;
        this.eventName = eventName;
    }

    public void showDialog() {
        new SlyCalendarDialog()
                .setSingle(false)
                .setCallback(Activity.this)
                .show(getFragmentManager(), "TAG_SLYCALENDAR");
    }

    [USER=69643]@override[/USER]
    public void onCancelled() {
        //TODO: Raise BA Event
    }

    [USER=69643]@override[/USER]
    public void onDataSelected(Calendar calendar, Calendar calendar1, int i, int i1) {
        //TODO: Raise BA Event
    }
}

Do you have any idea of a better solution when wrapping dialogs ?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…