Skip to content

url_launcher java.lang.RuntimeException: Unable to destroy activity, java.lang.IllegalArgumentException: Receiver not registered #127014

Description

@SilkeAtSiip

Is there an existing issue for this?

Steps to reproduce

  1. open a in app browser on a android device
  2. close the in app browser again

Expected results

The app should not crash when closing a in app browser.

Actual results

The error mentioned in the title throws and the app crashes.

A more extensive bug report and a (temporary solution) can be found here: https://stackoverflow.com/questions/76244218/flutter-url-launcher-plugin-throws-java-lang-illegalargumentexception-receiver

Code sample

Code sample
GestureDetector(
    onTap: () => launchUrl(
          Uri.parse(myStringUrl),
        ),
),

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.7.10, on macOS 13.0.1 22A400 darwin-x64, locale nl-NL)
    • Flutter version 3.7.10 on channel stable at /Users/myUserName/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4b12645012 (6 weeks ago), 2023-04-03 17:46:48 -0700
    • Engine revision ec975089ac
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
    • Android SDK at /Users/myUserName/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.78.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] Connected device (3 available)
    • iPhone (mobile) • 10980a6ed605f82f401441bf424597d5a4a7eb8e • ios            • iOS
      16.1.2 20B110
    • macOS (desktop)             • macos                                    • darwin-x64     •
      macOS 13.0.1 22A400 darwin-x64
    • Chrome (web)                • chrome                                   • web-javascript •
      Google Chrome 98.0.4758.109

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Activity

  1. added
    in triagePresently being triaged by the triage team
    on May 17, 2023
  2. huycozy commented on May 17, 2023

    @huycozy
    Member

    Thanks for the report. I also can reproduce this issue on the latest plugin version.

    • Sample code: url_launcher example

    • Affected on:

      • launch mode: LaunchMode.inAppWebView
      • platform: Android
      • version: url_launcher: ^6.1.11 and url_launcher_android: ^6.0.33
    • The issue doesn't happen on url_launcher_android: 6.0.31. May be introduced by PR 3973. Labeling the issue for further investigation.

    Crash log
    D/AndroidRuntime(14071): Shutting down VM
    E/AndroidRuntime(14071): FATAL EXCEPTION: main
    E/AndroidRuntime(14071): Process: com.example.reproduce_issues, PID: 14071
    E/AndroidRuntime(14071): java.lang.RuntimeException: Unable to destroy activity {com.example.reproduce_issues/io.flutter.plugins.urllauncher.WebViewActivity}: java.lang.IllegalArgumentException: Receiver not registered: io.flutter.plugins.urllauncher.WebViewActivity$1@faac413
    E/AndroidRuntime(14071): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5478)
    E/AndroidRuntime(14071): 	at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5507)
    E/AndroidRuntime(14071): 	at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
    E/AndroidRuntime(14071): 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
    E/AndroidRuntime(14071): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    E/AndroidRuntime(14071): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2328)
    E/AndroidRuntime(14071): 	at android.os.Handler.dispatchMessage(Handler.java:106)
    E/AndroidRuntime(14071): 	at android.os.Looper.loop(Looper.java:255)
    E/AndroidRuntime(14071): 	at android.app.ActivityThread.main(ActivityThread.java:8212)
    E/AndroidRuntime(14071): 	at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime(14071): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
    E/AndroidRuntime(14071): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
    E/AndroidRuntime(14071): Caused by: java.lang.IllegalArgumentException: Receiver not registered: io.flutter.plugins.urllauncher.WebViewActivity$1@faac413
    E/AndroidRuntime(14071): 	at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1533)
    E/AndroidRuntime(14071): 	at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1674)
    E/AndroidRuntime(14071): 	at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:725)
    E/AndroidRuntime(14071): 	at io.flutter.plugins.urllauncher.WebViewActivity.onDestroy(WebViewActivity.java:170)
    E/AndroidRuntime(14071): 	at android.app.Activity.performDestroy(Activity.java:8404)
    E/AndroidRuntime(14071): 	at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1344)
    E/AndroidRuntime(14071): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5463)
    E/AndroidRuntime(14071): 	... 11 more
    W/eproduce_issue(14071): Attempt to remove non-JNI local reference, dumping thread
    I/Process (14071): Sending signal. PID: 14071 SIG: 9
    Lost connection to device.
    flutter doctor -v (stable and master)
    [✓] Flutter (Channel stable, 3.10.0, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
        • Flutter version 3.10.0 on channel stable at /Users/huynq/Documents/GitHub/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 84a1e904f4 (35 hours ago), 2023-05-09 07:41:44 -0700
        • Engine revision d44b5a94c9
        • Dart version 3.0.0
        • DevTools version 2.23.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-33, build-tools 32.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14E222b
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2022.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    
    [✓] VS Code (version 1.78.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.62.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-x64     • macOS 13.0.1 22A400 darwin-x64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 113.0.5672.92
    
    [✓] Network resources
        • All expected network resources are available.
    
    • No issues found!
    [!] Flutter (Channel master, 3.11.0-6.0.pre.85, on macOS 13.0.1 22A400 darwin-x64, locale en-VN)
        • Flutter version 3.11.0-6.0.pre.85 on channel master at /Users/huynq/Documents/GitHub/flutter_master
        ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 2919572fb3 (71 minutes ago), 2023-05-15 19:01:28 -0700
        • Engine revision c4d4b40c65
        • Dart version 3.1.0 (build 3.1.0-113.0.dev)
        • DevTools version 2.23.1
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
        • Android SDK at /Users/huynq/Library/Android/sdk
        • Platform android-33, build-tools 32.0.0
        • ANDROID_HOME = /Users/huynq/Library/Android/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 14.3)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 14E222b
        • CocoaPods version 1.11.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2022.2)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
        • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    
    [✓] VS Code (version 1.78.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.64.0
    
    [✓] Connected device (3 available)
        • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64  • Android 11 (API 30)
        • macOS (desktop)  • macos            • darwin-x64     • macOS 13.0.1 22A400 darwin-x64
        • Chrome (web)     • chrome           • web-javascript • Google Chrome 113.0.5672.92
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
  3. added
    c: crashStack traces logged to the console
    platform-androidAndroid applications specifically
    p: url_launcherPlugin to launch external applications
    packageflutter/packages repository. See also p: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    c: fatal crashCrashes that terminate the process
    and removed
    in triagePresently being triaged by the triage team
    on May 17, 2023
  4. okdevy commented on May 18, 2023

    @okdevy

    Having same issue

  5. gmackall commented on May 18, 2023

    @gmackall
    Member

    The revert here: flutter/packages#4027 should have fixed this issue, can you confirm whether on the latest version of url_launcher_android you are still encountering this issue?

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    P1High-priority issues at the top of the work list
    on May 18, 2023
  7. joknjokn commented on May 19, 2023

    @joknjokn

    I'm getting crashytlics reports of this crash + I can reproduce by opening a site with url_launcher, then returning to the app.

    url_launcher version 6.1.11.

  8. lstonussi commented on May 19, 2023

    @lstonussi

    Same issue here, with url_launcher version 6.1.11.
    @gmackall

  9. gmackall commented on May 19, 2023

    @gmackall
    Member

    Sorry, I should have clarified that this is fixed specifically in the latest version of url_launcher_android (6.0.34). There was not an associated version change to url_launcher. I've revised my previous comment to avoid confusion.

    I've also confirmed locally that the issue is reproducible in the (now retracted) version 6.0.33 of url_launcher android, but fixed in 6.0.34. Because of that I'm going to close this as fixed, but please report if you run into this issue while using the latest version of url_launcher_android and we can re-open.

  10. GeylanKalafMohe commented on May 21, 2023

    @GeylanKalafMohe

    To upgrade the transitive dependency use this command in the terminal:

    flutter pub upgrade url_launcher_android

  11. yadaniyil commented on May 29, 2023

    @yadaniyil
    dependency_overrides:
      url_launcher_android: 6.0.35
    

    Works for me

  12. github-actions commented on Jun 12, 2023

    @github-actions

    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, including the output of flutter doctor -v and a minimal reproduction of the issue.

  13. locked as resolved and limited conversation to collaborators on Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processfound in release: 3.10Found to occur in 3.10found in release: 3.11Found to occur in 3.11has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: url_launcherPlugin to launch external applicationspackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallywaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions