-
Notifications
You must be signed in to change notification settings - Fork 599
Description
Hello everyone,
I use the package on huge scale (around 1millions devices) i have a big problem, for months about the obfucation on Android, where some stuff related to FileProvider was missing.
The consequence, was that when i tried opening a file, the app just crashed without any warning or error in flutter.
Sometimes it didn't even report in Firebase.
Here the error message :
Fatal Exception: java.lang.IncompatibleClassChangeError: Class 'android.content.res.XmlBlock$Parser' does not implement interface 'n8.a' in call to 'int n8.a.next()' (declaration of 'androidx.core.content.FileProvider' appears in base.apk) at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:19) at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:11) at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:1) at com.crazecoder.openfile.utils.FileUtil.getFileUri(FileUtil.java:48) at com.crazecoder.openfile.OpenFilePlugin.startActivity(OpenFilePlugin.java:24)
After tons of trouble, and the help of Gemini, i found the rules for pro guards to make it work (i trieds tons of rules before, but here the one that work in my case)
-keep public class androidx.core.content.FileProvider { *; }
-keepnames class * implements android.os.Parcelable
-keepclassmembers class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *; }
-keep class android.content.res.XmlBlock { *; }
-keep class android.content.res.XmlBlock$Parser { *; }
-keep class org.xmlpull.** { *; }
-keep class android.content.res.XmlResourceParser { *; }
-keepclassmembers class **.R$xml {
public static *;
}
-keep public class **.R$xml