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

Incompatibility with latest background_downloader #1836

Closed
2 tasks done
mgilberti-horta opened this issue Oct 17, 2023 · 3 comments
Closed
2 tasks done

Incompatibility with latest background_downloader #1836

mgilberti-horta opened this issue Oct 17, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@mgilberti-horta
Copy link

  • I have read the Getting Started section
  • I have already searched for the same problem

Environment

Technology Version
Flutter version 3.16.0-12.0.pre.19
Plugin version 6.0.0-beta.25
Android version 13

Device information:
Samsung A14 5G

Description

Simply adding background_downloader (7.10.1) import is causing our flutter_inappwebview (6.0.0-beta.25) based app to crash on Android in release mode (debug is working fine on both physical device and emulator).

Expected behavior:
I was expecting it to work properly as in debug mode.

Steps to reproduce

  1. Create a new flutter_inappwebview base app (even examples are fine)
  2. Add background_downloader to the pubspec.yaml
  3. Add import 'package:background_downloader/background_downloader.dart'; to your main.dart
  4. Run in release mode on a physical device or on emulator

Stacktrace/Logcat

[ +45 ms] E/flutter ( 5721): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: com.pichillilorenzo/flutter_inappwebview
[ ] E/flutter ( 5721): at io.flutter.plugin.platform.c0.M(SourceFile:1)
[ ] E/flutter ( 5721): at io.flutter.plugin.platform.c0$a.g(SourceFile:1)
[ ] E/flutter ( 5721): at b2.l$a.c(SourceFile:1)
[ ] E/flutter ( 5721): at b2.l$a.onMethodCall(SourceFile:1)
[ ] E/flutter ( 5721): at c2.i$a.a(SourceFile:1)
[ ] E/flutter ( 5721): at u1.c.k(SourceFile:1)
[ ] E/flutter ( 5721): at u1.c.l(SourceFile:1)
[ ] E/flutter ( 5721): at u1.c.d(SourceFile:1)
[ ] E/flutter ( 5721): at u1.b.run(SourceFile:1)
[ ] E/flutter ( 5721): at android.os.Handler.handleCallback(Handler.java:958)
[ ] E/flutter ( 5721): at android.os.Handler.dispatchMessage(Handler.java:99)
[ ] E/flutter ( 5721): at android.os.Looper.loopOnce(Looper.java:205)
[ ] E/flutter ( 5721): at android.os.Looper.loop(Looper.java:294)
[ ] E/flutter ( 5721): at android.app.ActivityThread.main(ActivityThread.java:8177)
[ ] E/flutter ( 5721): at java.lang.reflect.Method.invoke(Native Method)
[ ] E/flutter ( 5721): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
[ ] E/flutter ( 5721): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
[ ] E/flutter ( 5721): , null, null)
[ ] E/flutter ( 5721): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651)
[ ] E/flutter ( 5721): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334)
[ ] E/flutter ( 5721):
[ ] E/flutter ( 5721): #2 ExpensiveAndroidViewController._sendCreateMessage (package:flutter/src/services/platform_views.dart:1081)
[ ] E/flutter ( 5721):
[ ] E/flutter ( 5721): #3 AndroidViewController.create (package:flutter/src/services/platform_views.dart:804)
[ ] E/flutter ( 5721):
[ ] E/flutter ( 5721):

full_verbose.log

@mgilberti-horta mgilberti-horta added the bug Something isn't working label Oct 17, 2023
@github-actions
Copy link

👋 @mgilberti-horta

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@mgilberti-horta
Copy link
Author

It turns out that code shrinking via R8 (enabled by default in release mode) was removing plugin registrations.
To fix it one can disable code shrinking by editing build.gradle:

   buildTypes {
       release {
            shrinkResources false
            minifyEnabled false
            signingConfig signingConfigs.release
       }
   }

or use a properly configured proguard file.

Copy link

github-actions bot commented Oct 6, 2024

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 Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant