Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease

前端 未结 6 2132
没有蜡笔的小新
没有蜡笔的小新 2020-12-04 17:50

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:



        
相关标签:
6条回答
  • 2020-12-04 18:04

    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!

    0 讨论(0)
  • 2020-12-04 18:05

    You can try this keep class com.xyz.** { *; } -dontwarn com.xyz.**

    0 讨论(0)
  • 2020-12-04 18:09

    add the below to your ProGuard rules

    -ignorewarnings
    
    -keep class * {
        public private *;
    }
    

    and rebuild your project.

    0 讨论(0)
  • 2020-12-04 18:18

    try this at your proguard-rules.pro

    -ignorewarnings
    -keep class * {
        public private *;
    }
    
    0 讨论(0)
  • 2020-12-04 18:24
    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.

    0 讨论(0)
  • 2020-12-04 18:30

    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

    0 讨论(0)
提交回复
热议问题