Skip to content

Android. NoSuchMethodError (NoSuchMethodError: No top-level getter '_registerPlugins' declared. #77680

Closed

Description

@ekasetiawans

I am developing a plugin that execute dartCallback in background service.
But I got this exception when I run the example app.

NoSuchMethodError (NoSuchMethodError: No top-level getter '_registerPlugins' declared.

Steps to Reproduce

  1. Clone https://github.com/ekasetiawans/flutter_background_service
  2. Run example project on Android
  3. Exception thrown

Expected results:
Exception not thrown.

Actual results:
Exception thrown.

Logs
ekasetiawans@MacBookPro ~ % flutter doctor -v
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.3 20D91 darwin-x64, locale
    en-ID)
    • Flutter version 2.0.1 at /Users/ekasetiawans/Development/flutter-stable
    • Framework revision c5a4b4029c (5 days ago), 2021-03-04 09:47:48 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/ekasetiawans/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.1)
    • 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
      1.8.0_242-release-1644-b3-6915495)

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

[✓] Connected device (3 available)
    • sdk gphone x86 64 arm64 (mobile) • emulator-5554 • android-x64    •
      Android 11 (API 30) (emulator)
    • macOS (desktop)                  • macos         • darwin-x64     • macOS
      11.2.3 20D91 darwin-x64
    • Chrome (web)                     • chrome        • web-javascript • Google
      Chrome 87.0.4280.88

• No issues found!

Activity

  1. ekasetiawans commented on Mar 9, 2021

    @ekasetiawans
    Author

    image

  2. TahaTesser commented on Mar 9, 2021

    @TahaTesser
    Contributor

    Hi @ekasetiawans
    It seems you are asking for assistance on personal code. Please see https://flutter.dev/community for resources and asking questions like this,
    you may also get some help if you post it on Stack Overflow and if you need help with your code, please see https://www.reddit.com/r/flutterhelp/
    Closing, as this isn't an issue with Flutter itself. If you disagree, please write in the comments and I will reopen it.
    Thank you

  3. added
    r: invalidIssue is closed as not valid
    and removed
    in triagePresently being triaged by the triage team
    on Mar 9, 2021
  4. ekasetiawans commented on Mar 9, 2021

    @ekasetiawans
    Author

    @TahaTesser no, i just report, I got that exception. the code just works before flutter 2.

  5. ekasetiawans commented on Mar 9, 2021

    @ekasetiawans
    Author

    @TahaTesser maybe the exception came from this #74469 but I'm not sure.

  6. ekasetiawans commented on Mar 9, 2021

    @ekasetiawans
    Author

    image

    There isn't any _registerPlugins text in my source code, so I'm pretty sure that this exception is in flutter sdk.
  7. added
    in triagePresently being triaged by the triage team
    and removed
    r: invalidIssue is closed as not valid
    on Mar 9, 2021
  8. TahaTesser commented on Mar 9, 2021

    @TahaTesser
    Contributor

    @ekasetiawans
    Based on my search, similar errors are reported by the code issues but here it might be different, I will reproduce it

  9. TahaTesser commented on Mar 9, 2021

    @TahaTesser
    Contributor

    Hi @ekasetiawans
    Running your the example app on the latest stable, no such error I can reproduce

    logs
    Launching lib/main.dart on SM M025F in debug mode...
    Running Gradle task 'assembleDebug'...
    ✓ Built build/app/outputs/flutter-apk/app-debug.apk.
    Debug service listening on ws://127.0.0.1:65155/I8e8GtaUQZ0=/ws
    Syncing files to device SM M025F...
    D/BackgroundServicePlugin(16844): onAttachedToService
    I/ViewRootImpl@d82458f[MainActivity](16844): Relayout returned: old=(0,0,720,1600) new=(0,0,720,1600) req=(720,1600)0 dur=11 res=0x1 s={true 3342616576} ch=false
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): MSG_WINDOW_FOCUS_CHANGED 0 1
    D/InputMethodManager(16844): prepareNavigationBarInfo() DecorView@4364933[MainActivity]
    D/InputMethodManager(16844): getNavigationBarColor() -855310
    D/InputTransport(16844): Input channel destroyed: 'ClientS', fd=86
    I/SurfaceView(16844): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/SurfaceView(16844): surfaceDestroyed callback.size 1 #2 io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574}
    I/SurfaceView(16844): remove() io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} Surface(name=SurfaceView - id.flutter.flutter_background_service_example/id.flutter.flutter_background_service_example.MainActivity@ea0a425@0)/@0xec1dd9e
    D/OpenGLRenderer(16844): makeCurrent EglSurface : 0xeea7f900 -> 0x0
    D/OpenGLRenderer(16844): destroyEglSurface : 0xeea7f900
    D/OpenGLRenderer(16844): ~ReliableSurface : 0xeea83480
    I/ViewRootImpl@d82458f[MainActivity](16844): Relayout returned: old=(0,0,720,1600) new=(0,0,720,1600) req=(720,1600)8 dur=10 res=0x5 s={false 0} ch=true
    I/ViewRootImpl@d82458f[MainActivity](16844): stopped(true) old=false
    I/SurfaceView(16844): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/SurfaceView(16844): onWindowVisibilityChanged(4) false io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/ViewRootImpl@d82458f[MainActivity](16844): Relayout returned: old=(0,0,720,1600) new=(0,0,720,1600) req=(720,1600)4 dur=9 res=0x1 s={false 0} ch=false
    I/ViewRootImpl@d82458f[MainActivity](16844): stopped(false) old=true
    I/SurfaceView(16844): windowStopped(false) false io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/ViewRootImpl@d82458f[MainActivity](16844): stopped(false) old=false
    I/SurfaceView(16844): onWindowVisibilityChanged(0) true io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/ViewRootImpl@d82458f[MainActivity](16844): Relayout returned: old=(0,0,720,1600) new=(0,0,720,1600) req=(720,1600)0 dur=14 res=0x7 s={true 4004659200} ch=true
    D/OpenGLRenderer(16844): createReliableSurface : 0xeea83480(0xeeb24000)
    D/OpenGLRenderer(16844): eglCreateWindowSurface : 0xeea7f900
    I/SurfaceView(16844): surfaceCreated 1 #8 io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574}
    I/SurfaceView(16844): surfaceChanged (720,1574) 1 #8 io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574}
    D/OpenGLRenderer(16844): makeCurrent EglSurface : 0x0 -> 0xeea7f900
    I/OpenGLRenderer(16844): doUpdatePositionAsync is called and callVoidMethod
    I/ViewRootImpl@d82458f[MainActivity](16844): MSG_WINDOW_FOCUS_CHANGED 1 1
    D/InputMethodManager(16844): prepareNavigationBarInfo() DecorView@4364933[MainActivity]
    D/InputMethodManager(16844): getNavigationBarColor() -855310
    D/InputMethodManager(16844): prepareNavigationBarInfo() DecorView@4364933[MainActivity]
    D/InputMethodManager(16844): getNavigationBarColor() -855310
    V/InputMethodManager(16844): Starting input: tba=id.flutter.flutter_background_service_example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
    D/InputMethodManager(16844): startInputInner - Id : 0
    I/InputMethodManager(16844): startInputInner - mService.startInputOrWindowGainedFocus
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): MSG_WINDOW_FOCUS_CHANGED 0 1
    D/InputMethodManager(16844): prepareNavigationBarInfo() DecorView@4364933[MainActivity]
    D/InputMethodManager(16844): getNavigationBarColor() -855310
    D/InputTransport(16844): Input channel destroyed: 'ClientS', fd=92
    I/SurfaceView(16844): onWindowVisibilityChanged(8) false io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/SurfaceView(16844): surfaceDestroyed callback.size 1 #2 io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574}
    I/SurfaceView(16844): remove() io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} Surface(name=SurfaceView - id.flutter.flutter_background_service_example/id.flutter.flutter_background_service_example.MainActivity@ea0a425@1)/@0x45b07f
    D/OpenGLRenderer(16844): makeCurrent EglSurface : 0xeea7f900 -> 0x0
    D/OpenGLRenderer(16844): destroyEglSurface : 0xeea7f900
    D/OpenGLRenderer(16844): ~ReliableSurface : 0xeea83480
    I/ViewRootImpl@d82458f[MainActivity](16844): Relayout returned: old=(0,0,720,1600) new=(0,0,720,1600) req=(720,1600)8 dur=14 res=0x5 s={false 0} ch=true
    I/ViewRootImpl@d82458f[MainActivity](16844): stopped(true) old=false
    I/SurfaceView(16844): windowStopped(true) false io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/SurfaceView(16844): onWindowVisibilityChanged(4) false io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/ViewRootImpl@d82458f[MainActivity](16844): Relayout returned: old=(0,0,720,1600) new=(0,0,720,1600) req=(720,1600)4 dur=8 res=0x1 s={false 0} ch=false
    I/ViewRootImpl@d82458f[MainActivity](16844): stopped(false) old=true
    I/SurfaceView(16844): windowStopped(false) false io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/ViewRootImpl@d82458f[MainActivity](16844): stopped(false) old=false
    I/SurfaceView(16844): onWindowVisibilityChanged(0) true io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574} of ViewRootImpl@d82458f[MainActivity]
    I/ViewRootImpl@d82458f[MainActivity](16844): Relayout returned: old=(0,0,720,1600) new=(0,0,720,1600) req=(720,1600)0 dur=13 res=0x7 s={true 3342288896} ch=true
    D/OpenGLRenderer(16844): createReliableSurface : 0xeea83480(0xc7374800)
    D/OpenGLRenderer(16844): eglCreateWindowSurface : 0xeea7f900
    I/SurfaceView(16844): surfaceCreated 1 #8 io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574}
    I/SurfaceView(16844): surfaceChanged (720,1574) 1 #8 io.flutter.embedding.android.FlutterSurfaceView{ea0a425 V.E...... ........ 0,0-720,1574}
    D/OpenGLRenderer(16844): makeCurrent EglSurface : 0x0 -> 0xeea7f900
    I/OpenGLRenderer(16844): doUpdatePositionAsync is called and callVoidMethod
    I/ViewRootImpl@d82458f[MainActivity](16844): MSG_WINDOW_FOCUS_CHANGED 1 1
    D/InputMethodManager(16844): prepareNavigationBarInfo() DecorView@4364933[MainActivity]
    D/InputMethodManager(16844): getNavigationBarColor() -855310
    D/InputMethodManager(16844): prepareNavigationBarInfo() DecorView@4364933[MainActivity]
    D/InputMethodManager(16844): getNavigationBarColor() -855310
    V/InputMethodManager(16844): Starting input: tba=id.flutter.flutter_background_service_example ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
    D/InputMethodManager(16844): startInputInner - Id : 0
    I/InputMethodManager(16844): startInputInner - mService.startInputOrWindowGainedFocus
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 0
    I/ViewRootImpl@d82458f[MainActivity](16844): ViewPostIme pointer 1
    
    flutter doctor -v
    [✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.2 20D80 darwin-x64, locale en-GB)
        • Flutter version 2.0.1 at /Users/tahatesser/Code/flutter_stable
        • Framework revision c5a4b4029c (5 days ago), 2021-03-04 09:47:48 -0800
        • Engine revision 40441def69
        • Dart version 2.12.0
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Volumes/Extreme/SDK
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /Volumes/Extreme/SDK
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS
        • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
        • Xcode 12.4, Build version 12D4e
        • CocoaPods version 1.10.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • 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 1.8.0_242-release-1644-b3-6915495)
    
    [✓] VS Code (version 1.54.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.20.0
    
    [✓] Connected device (4 available)
        • SM M025F (mobile)    • R9ZR205XX0A               • android-arm    • Android 10 (API 29)
        • Taha’s iPad (mobile) • 00008020-000255113EE8402E • ios            • iOS 14.4
        • macOS (desktop)      • macos                     • darwin-x64     • macOS 11.2.2 20D80 darwin-x64
        • Chrome (web)         • chrome                    • web-javascript • Google Chrome 89.0.4389.82
    
    • No issues found!
    

    Please steps to reproduce the issue and also provide a flutter version which this wasn't an issue to confirm regression
    Thank you

  10. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 9, 2021
  11. 32 remaining items

  12. johnpryan commented on Apr 5, 2021

    @johnpryan
    Contributor

    @orestesgaolin found some steps to reproduce this exception - launch the app using a deep link on an Android emulator after it has been closed with the back button twice. I added them to this issue. This happens on the master and stable channel.

    The flutter run -v output doesn't show the exception AFAICT, so I left it out. Here's the output I see:

    Logs
    NoSuchMethodError: No top-level getter '_registerPlugins' declared.
    Receiver: top-level
    Tried calling: _registerPlugins
    
    NoSuchMethodError._throwNew (errors_patch.dart:212)
    
    Screen Shot 2021-04-05 at 1 33 12 PM
  13. zanderso commented on Apr 5, 2021

    @zanderso
    Member

    @blasten with the change re-landed in the engine, can you try to repro using these instructions?

  14. ekasetiawans commented on Apr 5, 2021

    @ekasetiawans
    Author
  15. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 5, 2021
  16. blasten commented on Apr 5, 2021

    @blasten

    I was able to reproduce #79810, and I'm investigating.

  17. blasten commented on Apr 5, 2021

    @blasten

    This appears to only occur when the app is launched from VSCode with an attached debugger. I'm unable to reproduce it with just flutter run. The VSCode extension runs the VM with different flags. https://github.com/Dart-Code/Dart-Code/blob/57ead070d6a96d42839b6c6fe148716d9f8b97f1/src/debug/flutter_debug_impl.ts#L228

  18. zanderso commented on Apr 6, 2021

    @zanderso
    Member

    @blasten What are the differences? Just --start-paused or were there also others? --start-paused is pretty common, and we'll have to continue supporting that.

  19. blasten commented on Apr 6, 2021

    @blasten

    I've been using flutter run --start-paused and the debugger, but I'm still unable to reproduce the same behavior observed from the VSCode extension. I will try to build the extension.

    @ekasetiawans can you also confirm that if you type in the command line flutter run, you don't get the exception?

  20. ekasetiawans commented on Apr 6, 2021

    @ekasetiawans
    Author

    @blasten yes, I don't get the exception when using flutter run command

  21. blasten commented on Apr 12, 2021

    @blasten
  22. cuongvue commented on May 7, 2021

    @cuongvue

    which flutter version can I use to fix this bug please? I'm using Channel stable, 2.0.6 but get the same error

  23. zanderso commented on May 7, 2021

    @zanderso
    Member

    It looks like the revert above should have made it into the 2.2 beta.

  24. github-actions commented on Aug 2, 2021

    @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.

  25. locked as resolved and limited conversation to collaborators on Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: regressionIt was better in the past than it is nowtoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions