Android Question MaterialDialogBuilder error

red30

Well-Known Member
Licensed User
Longtime User
I needed to use an old project that was written a long time ago. Now I've encountered a problem: it uses MaterialDialogBuilder, and I get an error when working with it.
B4X:
    Builder.Initialize("Dialog")
    Builder.Title("Registration mode")
    Builder.Content("The remote control is in registration mode... Press exit to exit this mode.")
    Builder.Progress(True, 0)
    Builder.ProgressIndeterminateStyle(False)
    Builder.NegativeText("Exit")
B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/content/ContextCompat;
    at com.afollestad.materialdialogs.util.DialogUtils.getColor(DialogUtils.java:127)
    at com.afollestad.materialdialogs.MaterialDialog$Builder.<init>(MaterialDialog.java:1151)
    at de.amberhome.materialdialogs.MaterialDialogBuilderWrapper.Initialize(MaterialDialogBuilderWrapper.java:101)
    at forteza.forteza32full.rk._activity_create(rk.java:397)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
    at forteza.forteza32full.rk.afterFirstLayout(rk.java:105)
    at forteza.forteza32full.rk.access$000(rk.java:17)
    at forteza.forteza32full.rk$WaitForLayout.run(rk.java:83)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:236)
    at android.app.ActivityThread.main(ActivityThread.java:7912)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
Caused by: java.lang.ClassNotFoundException: android.support.v4.content.ContextCompat
    ... 16 more
As far as I understand, this library is deprecated. Can I make it work? What can I use instead?
Is there any way to make the MaterialDialogBuilder library work without rewriting the project?
 
Last edited:

red30

Well-Known Member
Licensed User
Longtime User
Yes, I'd like to, but I'd have to rewrite the project significantly. I write all new projects using B4XDialogs. I'd just like to quickly restore functionality here, if possible.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Yes, I'd like to, but I'd have to rewrite the project significantly. I write all new projects using B4XDialogs. I'd just like to quickly restore functionality here, if possible.
Search the forum for how to a reference this jar (#AdditionJar) in your B4A project and see if it works

android/support/v4/content/ContextCompat

You need to point to android.support.v4.content.contextcompat
 
Upvote 0
Top