Tapadoo / Alerter

An Android Alerting Library
MIT License
5.52k stars 633 forks source link

Resources$NotFoundException: Drawable com.example.myapp:drawable/button_alerter with resource ID #0x7f0800ac #262

Closed parmarravi closed 3 years ago

parmarravi commented 3 years ago

The App is getting crashed in release apk with firebase message

Caused by android.content.res.Resources$NotFoundException: Drawable com.example.myapp:drawable/button_alerter with resource ID #0x7f0800ac

The Project has lib version 7.0.0

App works fine in debug version but in release apk it crashes . Its showing custom style for the button is not found.

Crash confirm in Android 11 and Android 10 Device OnePlus

Code


    public static void showTopBarAlertDialog(Activity activity, String title, String msg ,int  bckColor, TopBarAlertDialogImpl topBarAlertDialogCallback) {
        Alerter.create(activity)
                .setTitle(title)
                .setBackgroundColorRes(bckColor)
                .setIcon(R.mipmap.ic_launcher)
                .setIconColorFilter(0) // Optional - Removes white tint
                .setText(msg)
                .addButton("Go To Settings", R.style.AlertButton, new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        topBarAlertDialogCallback.goToSettings();
                    }
                })
                .enableVibration(true)
                .setDismissable(true)
                .setDuration(10000)
                .enableSwipeToDismiss()
                .show();
    }
kpmmmurphy commented 3 years ago

Thanks for the details report @parmarravi. Are you using ProGuard in release?

parmarravi commented 3 years ago

Yes. Basic Alerter Dialog works properly even in proguard. But when I added a button to the dialog and added the style .It got crashed

kpmmmurphy commented 3 years ago

Please have a look at this article which outlines how to ensure ProGuard doesn't remove drawable resources.

https://shrikanth.in/android/issues/2020/07/05/shrink-resources-not-found.html