Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bipinvaylu opened this issue Jul 26, 2020 · 8 comments
Closed

Comments

@bipinvaylu
Copy link

bipinvaylu commented Jul 26, 2020

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
Copy link

running into the same error

@ThundR67
Copy link

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

@bipinvaylu
Copy link
Author

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
Copy link
Owner

Ahmadre commented Jul 28, 2020

@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: flutter/flutter#16311

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

Best regards.

@Ahmadre Ahmadre closed this as completed Jul 28, 2020
@qcsltd
Copy link

qcsltd commented Sep 2, 2020

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
Copy link
Owner

Ahmadre commented Oct 27, 2020

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
Copy link

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

@manojeeva
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants