I am trying to export apk and I want to enable Proguard but it throwing below error. I read so many answers and tried but didn\'t worked. Getting below error:
Close the project and Android Studio. Open the project again, rebuild the project. And then you can try to generate the APK. That's worked for me. Though wired!
You can try this
keep class com.xyz.** { *; }
-dontwarn com.xyz.**
add the below to your ProGuard rules
-ignorewarnings
-keep class * {
public private *;
}
and rebuild your project.
try this at your proguard-rules.pro
-ignorewarnings
-keep class * {
public private *;
}
buildTypes { release { shrinkResources true minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }
Please remove this line of code in your gradle. This worked for me.
Only -ignorewarnings
this line solved my problem.
Also Add the following line to <ProjectRoot>/android/gradle.properties
to Obfuscating Dart Code:
extra-gen-snapshot-options=--obfuscate
Please refer this and this for more information.
Also If you using Firebase Auth please add it to proguard-rules.pro file:
-keep class com.google.firebase.** { *; }
Sharing my /android/app/proguard-rules.pro
file
#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.** { *; }
-ignorewarnings
Hope someone will help this