Flutter issue on publishing app on Google Play Store

967

You are facing this issue because you have minifyEnabled true in your build.gradle(app).

There are 2 solutions.

  1. Remove minifyEnabled true

  2. Follow these steps.

In your <ProjectRoot>/android/gradle.properties, add

extra-gen-snapshot-options=--obfuscate

You need to create the file in /android/app/proguard-rules.pro

#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }

And add to /android/app/build.gradle typical proguard config

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

Source

Share:
967
CopsOnRoad
Author by

CopsOnRoad

Updated on December 10, 2022

Comments

  • CopsOnRoad
    CopsOnRoad over 1 year

    Running "flutter packages get" in NativeApplication... 2.0s Initializing gradle... 1.4s Resolving dependencies... 9.8s ProGuard, version 6.0.3 Reading input... .... Initializing...

    Warning: io.flutter.plugin.platform.PlatformPlugin: can't find referenced method 'ActivityManager$TaskDescription(java.lang.String,int,int)' in library class android.app.ActivityMana ger$TaskDescription Warning: io.flutter.view.ResourceExtractor: can't find referenced method 'long getLongVersionCode()' in library class android.content.pm.PackageInfo Warning: there were 2 unresolved references to library class members. You probably need to update the library versions. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember) Warning: Exception while processing task java.io.IOException: Please correct the above warnings first. Thread(Tasks limiter_2): destruction

    **FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.

    Job failed, see logs for details * 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 19s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 19.7s


    The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app. See for more information on the problem and how to fix it.


    Gradle task assembleRelease failed with exit code 1

  • Admin
    Admin over 5 years
    1st method is working thanks a lot. 2nd method is not working. I added shrinkResources false. but still getting error