Ahmadre / FlutterIconPicker

An adaptive comprehensive IconPicker for Flutter
MIT License
112 stars 76 forks source link

Android release build failing due to some tree shake icon issue #9

Closed bipinvaylu closed 4 years ago

bipinvaylu commented 4 years ago

Thanks for this awesome library. I am using latest version of this library, But somehow I can't able to create release apk.

Please find logs here:

You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to
reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:  https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations:
  - file:///Users/bipinvaylu/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_iconpicker-2.1.2/lib/Serialization/iconDataSerialization.dart:22:14
Running Gradle task 'assembleRelease'...                                

FAILURE: Build failed with an exception.                                                                                                                                                                              
* Where:                                                                                                   
Script '/Users/bipinvaylu/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 897                                                                                                                             
* What went wrong:                                                                                         
Execution failed for task ':app:compileFlutterBuildRelease'.                                               
> Process 'command '/Users/bipinvaylu/flutter/bin/flutter'' finished with non-zero exit value 1     

* Try:                                                                                                     
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 
Run with --scan to get full insights.

* Get more help at https://help.gradle.org                                                                                                                                                                            
BUILD FAILED in 2m 46s                                                                                     
Running Gradle task 'assembleRelease'...                                                                   
Running Gradle task 'assembleRelease'... Done                     167.1s (!)
Gradle task assembleRelease failed with exit code 1

Please let me know if you want any other details.

ThundR67 commented 4 years ago

running into the same error

ThundR67 commented 4 years ago

Try to build with --no-tree-shake-icons. It works for me flutter build apk --no-tree-shake-icons

bipinvaylu commented 4 years ago

Thanks @SonicRoshan, But what does this --no-tree-shake-icons means? Do you have any related link So i can know what is the effect of this on released build?

Ahmadre commented 4 years ago

@bipinvaylu Thank you for your issue.

Originally this has to do with a Breaking Change in Flutter Framework for profile + release builds.

the option: --tree-shake-icons is set by default now and minimizes the apps build-size if an app uses material-design icons.

You can use --no-tree-shake-icons. For further informations see: https://github.com/flutter/flutter/issues/16311

Closing this issue for now, but feel free to reopen, if you encounter any further issues :).

Best regards.

qcsltd commented 3 years ago

Hi, can someone please tell me how i can specify the --no-tree-shake-icons in Xcode so I can build an iOS archive release for TestFlight.

I need to generate icons based on dynamic hexcodes, so returning a const is not an option for me, hence my Xcode build process is now failing (since upgrading to flutter v1.20).

Many thanks

Ahmadre commented 3 years ago

Hi, can someone please tell me how i can specify the --no-tree-shake-icons in Xcode so I can build an iOS archive release for TestFlight.

I need to generate icons based on dynamic hexcodes, so returning a const is not an option for me, hence my Xcode build process is now failing (since upgrading to flutter v1.20).

Many thanks

Use: flutter build ios --release --no-tree-shake-icons

luiscarielo83 commented 2 years ago

Same issue when trying to build APK. Any real solution other than --no-tree-shake-icons?

manojeeva commented 2 years ago

I did not use any icons in my app but still, I get this error. What could be causing this error?