This crash seems to happen only in ZTE BLADE V7 LITE phone.
Fatal Exception: java.lang.IllegalArgumentException: No font asset found for
at com.afollestad.materialdialogs.MaterialDialog$Builder.typeface(MaterialDialog.java:690)
at com.afollestad.materialdialogs.MaterialDialog$Builder.(MaterialDialog.java:556)
at com.utils.DialogManager.showLoginSignUpAlert(DialogManager.java:57)
at com.fragments.LoginFragment.onClick(LoginFragment.java:120)
at android.view.View.performClick(View.java:5265)
at android.view.View$PerformClick.run(View.java:21534)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
0.9.2.36.0ZTEBLADE V7 LITEThis isn't an issue with this library.
You're passing an empty string into the Builder.
Code works for every other phone except this one though
@cagkanciloglu hmm, well your log here would suggest that the "medium" String parameter is null or empty:

The best solution would probably be to wrap your Builder code with a try/catch block.
Suppressing this exception on my end would be bad because it may actually signal a user error in some cases.
Recently, I got the same crash on ZTE BLADE A910, Android 6.0.
It must be an issue with ZTE's skin.
This is what I don't understand about your code maybe there is a logic behind it I don't see. The function typeface throws that exception when mediumFont is null right? On the code you first call typeface then you check whether if mediumFont is null or not. Why don't you do this check before calling typeface function or inside the typeface function?
MaterialDialog line 556
#typeface(mediumFont, regularFont);
if (this.mediumFont == null) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
this.mediumFont = Typeface.create("sans-serif-medium", Typeface.NORMAL);
else
this.mediumFont = Typeface.create("sans-serif", Typeface.BOLD);
} catch (Exception ignored) {
}
}
if (this.regularFont == null) {
try {
this.regularFont = Typeface.create("sans-serif", Typeface.NORMAL);
} catch (Exception ignored) {
}
}
@cagkanciloglu that sets default typefaces from the system fonts.
And that isn't related to whatever happens in this device's skin.
Actually I guess it could be if those default typefaces don't exist, which would be unusual. I'll make a workaround.
Hi @afollestad,
Has this issue been fixed? I'm seeing this issue on ZTE devices also. using 0.9.4.4. Fabric
@trr-amsiq that log shows that you are passing a value to typeface(String, String) in the Builder which is not an existing font.
I'm not calling any typeface setter. Wouldn't this happen on other devices if what you are saying is true?
@afollestad
This is the code running:
new MaterialDialog.Builder(mainActivity)
.title(mainActivity.getString(R.string.app_name))
.content(mainActivity.getString(R.string.Application_Dialog_titleAboutToClose))
.positiveText(mainActivity.getString(R.string.Application_Dialog_actionClose))
.negativeText(mainActivity.getString(R.string.Shared_actionCancel))
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
if (mainActivity != null) {
mainActivity.finish();
}
}
})
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
dialog.dismiss();
}
})
.iconRes(R.drawable.ic_shared_icons_shared_alert)
.show();
@trr-amsiq default medium typefaces don't exist for some models @afollestad should make a workaround.
but he kinda doesn't give a sh*t and closed the issue.
put try-catch around the block and show default dialog in catch.
@afollestad won't fix ?? Really!!
@trr-amsiq welcome to make a pull request.
What I mean is that an issue should not be closed if it is a bug.
Keep it open so it is obvious that a pull request is welcome.
I added these two lines to styles.xml and it stopped crashing.
<item name="md_medium_font">NotoSans-Regular.ttf</item>
<item name="md_regular_font">NotoSans-Regular.ttf</item>
Should be fixed in 0.9.4.5.
Most helpful comment
Should be fixed in 0.9.4.5.