Skip to content

Custom notification button drawables are tree-shaken by default #134

@nuc134r

Description

@nuc134r

After recent Flutter 1.12 update building release APK with flutter build apk started to shrink unused resources. It might as well be something I missed during migration to the new Flutter version but it was quite painful to figure out.

:android:shrinkDebugResources
Removed unused resources: Binary resource data reduced from 2570KB to 1711KB: Removed 33%

As I was using custom icons for notification buttons and they were not referenced anywhere except Dart code it made them disappear from release apk.

MediaControl playControl = MediaControl(
  androidIcon: 'drawable/ic_action_play_arrow',
  label: 'Play',
  action: MediaAction.play,
);

I suggest documenting that somewhere in code or README.

In my case adding shrinkResources false into build.gradle solved the problem.

buildTypes {
    release {
        signingConfig signingConfigs.debug
        shrinkResources false
    }
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions