-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration options cannot be parsed on Android in release builds #294
Comments
This is also related #280 |
thanks very much |
Released new version |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue. |
After a quick debugging session for issue #237 I found out why it is not working. When Android is compiled for production, the code is optimized and named fields are renamed to a shorter variable name and mapped.
Unfortunately, the code for the configuration uses reflections to directly map values to field names. This cannot work in production when the optimizations are run because all the fields will have different names. It all works when you disable this feature, but this is not the solution. The solution would be to manually map everything without reflection features.
So release woks when minify and shrink is disabled in the release config
So, this code will fail for release when the variable names are optimized
flutter_inappwebview/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/Options.java
Lines 19 to 26 in 9c7ac0d
I noticed that in release builds, lots of those errors were popping up. Example of an error message:
Essentially this means that on Android, it was always using the configuration defaults and it was not possible to override any configuration at all.
@pichillilorenzo are you already working on this for the big refactoring you are doing at the moment? Or are you aware of this issue? We basically just have to get rid of the reflection usage and then I guess a lot of Android bug reports can be closed. I guess the
shouldOverrideUrlLoading
is not the only issue related to this problem.The text was updated successfully, but these errors were encountered: