Skip to content
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

Android Release build with minifyEnabled True is breaking in_app_webview #315

Closed
arnaudelub opened this issue Apr 2, 2020 · 2 comments
Closed

Comments

@arnaudelub
Copy link

arnaudelub commented Apr 2, 2020

Environment

**Flutter version: Flutter 1.12.13+hotfix.8
**Plugin version: Master branch

Description

Expected behavior:
initialOptions should be set when running in release mode

Current behavior:
options.crossplatform.useShouldOverrideUrlLoading = null even if set to true in the initialOptions.

Steps to reproduce

  1. set minifyEnabled true in android/app/build.gradle:
buildTypes {
  release {
    minifyEnabled true
  }
}

in the inappwebview widget add in initialOptions:

useShouldOverrideUrlLoading: true,

and add :

shouldOverrideUrlLoading: (InAppWebViewController controller,
             ShouldOverrideUrlLoadingRequest request) async {
           print("Override available: ${request.url}");
          return ShouldOverrideUrlLoadingAction.ALLOW;
},
  1. Then run flutter run --release
  2. shouldOverrideUrlLoading will never been called because useShouldOverrideUrlLoading is null

If minifyEnabled is set to false, it works as expected

Update

Same issue when using :

  • flutter build appbundle
    Using:
    flutter build appbundle --no-shrink solves the problem, seems like R8 is messing with something.
    doc: flutter.dev
@arnaudelub arnaudelub changed the title Android build with minifyEnabled True is breaking in_app_webview Android Release build with minifyEnabled True is breaking in_app_webview Apr 2, 2020
@arnaudelub
Copy link
Author

duplicate of #294

There is actually a pull request to fix it on branch a7100ae
you can use:

flutter_inappwebview:
    git:
      url: https://github.com/pichillilorenzo/flutter_inappwebview
      ref: a7100ae

The other workaround is to search for missing classes in logcat and add them to a proguard file

This was referenced Jul 6, 2020
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant