亲测可以!
测试机器环境如下:
Meizu Mx4 - Android 5.1 - Flyme 5.1.11.1A
First prepare your new app icons for each resolution and put them into the corresponding mipmap folders.
Then use activity-alias, for example, in your AndroidManifest.xml, edit this:
Add the following code when you want to change your app icon
PackageManager pm = getPackageManager(); pm.setComponentEnabledSetting( getComponentName(), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); pm.setComponentEnabledSetting( new ComponentName(this, "YOUR PACKAGE.MainAliasActivity"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);To reset the app icon you can use the same way.
Github: https://github.com/chinglimchan/ChangeAppIcon