Skip to content

bug: "Unknown control: Geolocator" on Android APK — extension registers but control times out #6384

@NightTracker

Description

@NightTracker

Duplicate Check

Describe the bug

flet-geolocator shows "Unknown control: Geolocator" red banner on Android APK builds. The Flutter-side GeolocatorService starts successfully (confirmed via adb logcat), but when the Python side creates a Geolocator control and calls request_permission() or get_current_position(), the Dart side never responds and the call times out after 10 seconds:
RuntimeError: TimeoutException after 0:00:10.000000: Timeout waiting for invoke method listener for Geolocator(10).request_permission
The extension IS included in the build — confirmed by checking build/flutter/pubspec.yaml and build/flutter/lib/main.dart:
dartimport 'package:flet_geolocator/flet_geolocator.dart' as flet_geolocator;
flet_geolocator.Extension(),
And adb logcat confirms the service starts:
FlutterGeolocator: Creating service.
FlutterGeolocator: Binding to location service.
FlutterGeolocator: Flutter engine connected. Connected engine count 1
But the control type is not recognized by the Dart renderer, causing the red "Unknown control: Geolocator" banner.

Code sample

Code
Minimal reproductionsingle main.py and requirements.txt:
main.py:
pythonimport flet as ft
import flet_geolocator as ftg

async def main(page: ft.Page):
    page.add(ft.Text("Testing Geolocator..."))

    gl = ftg.Geolocator()
    page.overlay.append(gl)
    page.update()

    try:
        perm = await gl.request_permission()
        page.add(ft.Text(f"Permission: {perm}"))
        pos = await gl.get_current_position()
        page.add(ft.Text(f"GPS: {pos.latitude}, {pos.longitude}"))
    except Exception as e:
        page.add(ft.Text(f"Error: {e}", color=ft.Colors.RED))
    page.update()

ft.run(main)
requirements.txt:
flet
flet-geolocator
Build command:
flet build apk --permissions location --clear-cache

To reproduce

  1. Create a folder with the main.py and requirements.txt shown above
  2. Run: flet build apk --permissions location --clear-cache
  3. Install the APK on an Android device (tested on Samsung Galaxy S25 Ultra)
  4. Open the app
  5. Red banner "Unknown control: Geolocator" appears immediately
  6. The request_permission() call times out after 10 seconds

Expected behavior

Expected behavior
The Geolocator control should be recognized by the Dart renderer, the Android location permission dialog should appear, and GPS coordinates should be returned.
Actual behavior

Red banner: "Unknown control: Geolocator"
request_permission() times out after 10 seconds
get_current_position() also times out after 10 seconds
No Android permission dialog appears

Screenshots / Videos

Captures

[Upload media here]

Image

Operating System

macOS

Operating system details

Build on macOS (Mac Studio) 15.7.4, test on Samsung Galaxy S25 Ultra (Android)

Flet version

Tested on 0.82.x, 0.83.1, and 0.84.0 — same result on all

Regression

I'm not sure / I don't know

Suggestions

The Dart-side GeolocatorService starts correctly (confirmed via adb logcat), so the Flutter extension is bundled and initialized. The issue appears to be that the control type mapping between the Python-side Geolocator control and the Dart renderer is broken — the Dart side doesn't recognize the control type name sent by Python. The method invoke listener is never registered, causing all method calls to time out.

Logs

Logs
[Paste your logs here]adb logcat showing the service starts successfully:

04-07 00:01:16.443 21054 21054 D FlutterGeolocator: Creating service.
04-07 00:01:16.443 21054 21054 D FlutterGeolocator: Binding to location service.
04-07 00:01:16.459 21054 21054 D FlutterGeolocator: Flutter engine connected. Connected engine count 1

Python starts successfully:

04-07 00:01:16.518 21054 21126 I flutter : [serious_python] CPython loaded
04-07 00:01:16.551 21054 21126 I flutter : [serious_python] after Py_Initialize()

Debug log from the app (written to file on device):

START
flet_geolocator imported OK
calling ft.run
main() called
creating Geolocator
appending to overlay
overlay updated
requesting permission
ERROR: TimeoutException after 0:00:10.000000: Timeout waiting for invoke method listener for Geolocator(10).request_permission

Additional details

Tested across Flet versions 0.82, 0.83.1, and 0.84.0 — identical behavior on all three. The flet-geolocator package version was matched to each flet version in every test.

The build/flutter/pubspec.yaml confirms the extension is included:

flet_geolocator:
path: /Users/.../build/flutter-packages/flet_geolocator

And build/flutter/lib/main.dart confirms it is imported and registered:

import 'package:flet_geolocator/flet_geolocator.dart' as flet_geolocator;
flet_geolocator.Extension(),

The flet_geolocator Flutter package's own pubspec.yaml references a development monorepo path for its flet dependency, which may be related:

dependencies:
flet:
path: ../../../../../../../packages/flet

Build environment:

  • macOS (Mac Studio)
  • Python 3.14
  • Test device: Samsung Galaxy S25 Ultra, Android
  • Build command: flet build apk --permissions location --clear-cache
  • Also tested on iOS Simulator with same result

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions