project ed500
project ed500

Reputation: 41

Build not succed in flutter

when i try flutter build apk --release , i get following error

FAILURE: Build failed with an exception.                                

* Where:                                                                
Build file 

'/Users/flutter/Documents/project_name/android/
build.gradle' line: 27

* What went wrong:                                                      
A problem occurred evaluating root project 
'android'.                   
> A problem occurred configuring project ':app'.                        
> Removing unused resources requires unused code 
shrinking to be turned on. See 
http://d.android.com/r/tools/shrink-resources.html 
for more information.

* 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 33s   

When i build for ios, i gets output. but having very large size around 400 mb.

How to resolve all these issues.......

Upvotes: 0

Views: 107

Answers (1)

Pratik Satani
Pratik Satani

Reputation: 1205

Not sure what is the issue but as per the error logs, you have to remove all the unused resource from code and then you have to set in gradle.

android {
...
buildTypes {
    release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
    }
}}

Also, if you will remove unused resouces, It will reduce the size of the iOS build.

Happy coding...

Upvotes: 1

Related Questions