Skip to content

[google_maps_flutter] App crashes with a java.lang.NullPointerException while popping a screen with a GoogleMaps widget #105965

@gianmarcocalbi

Description

@gianmarcocalbi

Internal: b/292548402

Steps to Reproduce

I have reproduced it on a Pixel 3 in debug mode REAL (Android 12) and emulated (api level 30).

  1. Execute flutter run on the code sample with google_maps_flutter: ^2.1.7 dependency
  2. Press the "Push map" button
  3. Press the top right "x" IconButton or the back arrow to pop the screen
  4. repeat from 2 until a crash occurs

Expected results:
No crash.

Actual results:
This 👇

telegram-cloud-document-4-5855147087196327296.mp4
Code sample
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class AltScreen extends StatelessWidget {
  const AltScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Alt screen'),
      ),
      body: Center(
        child: ElevatedButton(
          child: const Text('Push map'),
          onPressed: () => Navigator.of(context, rootNavigator: true).push(
            MaterialPageRoute(
              builder: (ctx) => Scaffold(
                appBar: AppBar(
                  actions: [
                    IconButton(
                      onPressed: Navigator.of(ctx, rootNavigator: true).pop,
                      icon: const Icon(Icons.close),
                    ),
                  ],
                ),
                body: const GoogleMap(
                  initialCameraPosition: CameraPosition(
                    target: LatLng(41.9, 12.5),
                    zoom: 17,
                  ),
                  compassEnabled: false,
                  myLocationButtonEnabled: false,
                  myLocationEnabled: false,
                  scrollGesturesEnabled: true,
                  zoomGesturesEnabled: true,
                  rotateGesturesEnabled: false,
                  zoomControlsEnabled: false,
                  mapToolbarEnabled: false,
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
Logs
D/MapsInitializer(32670): preferredRenderer: null
D/zzca    (32670): preferredRenderer: null
I/zzca    (32670): Making Creator dynamically
I/DynamiteModule(32670): Considering local module com.google.android.gms.maps_dynamite:0 and remote module com.google.android.gms.maps_dynamite:203115000
I/DynamiteModule(32670): Selected remote version of com.google.android.gms.maps_dynamite, version >= 203115000
V/DynamiteModule(32670): Dynamite loader version >= 2, using loadModule2NoCrashUtils
W/System  (32670): ClassLoader referenced unknown path: 
I/Google Maps Android API(32670): Google Play services client version: 12451000
I/Google Maps Android API(32670): Google Play services package version: 221820044
I/Google Maps Android API(32670): Google Play services maps renderer version(legacy): 203115000
D/MapsInitializer(32670): loadedRenderer: LEGACY
D/zzca    (32670): preferredRenderer: null
I/Google Maps Android API(32670): Google Play services package version: 221820044
I/Google Maps Android API(32670): Google Play services maps renderer version(legacy): 203115000
D/CompatibilityChangeReporter(32670): Compat change id reported: 171228096; UID 10533; state: ENABLED
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
I/ba      (32670): Successfully registered with Phenotype.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/FrameEvents(32670): updateAcquireFence: Did not find frame.
E/AndroidRuntime(32670): FATAL EXCEPTION: GLThread 446
E/AndroidRuntime(32670): Process: travel.wayt.wayt_app.dev, PID: 32670
E/AndroidRuntime(32670): java.lang.NullPointerException: Attempt to get length of null array
E/AndroidRuntime(32670): 	at java.nio.ByteBufferAsIntBuffer.put(ByteBufferAsIntBuffer.java:122)
E/AndroidRuntime(32670): 	at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.i(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):2)
E/AndroidRuntime(32670): 	at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.d(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):3)
E/AndroidRuntime(32670): 	at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):2)
E/AndroidRuntime(32670): 	at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):12)
E/AndroidRuntime(32670): 	at com.google.maps.api.android.lib6.gmm6.vector.bz.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):29)
E/AndroidRuntime(32670): 	at com.google.maps.api.android.lib6.gmm6.vector.bs.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):151)
E/AndroidRuntime(32670): 	at com.google.maps.api.android.lib6.gmm6.vector.av.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190400-0):48)
W/yt.wayt_app.de(32670): No such thread for suspend: 0x79cdae7ae8:androidmapsapi-DataRequestDispatcher-8
D/TransportRuntime.SQLiteEventStore(32670): Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
D/TransportRuntime.JobInfoScheduler(32670): Scheduling upload for context TransportContext(cct, HIGHEST, MSRodHRwczovL2NyYXNobHl0aWNzcmVwb3J0cy1wYS5nb29nbGVhcGlzLmNvbS92MS9maXJlbG9nL2xlZ2FjeS9iYXRjaGxvZ1xBSXphU3lCcnBTWVQ0RkZMMDlyZUhKaTZIOUZZZGVpU25VVE92Mk0=) with jobId=-689884277 in 4987ms(Backend next call timestamp 1655220308698). Attempt 1
I/Process (32670): Sending signal. PID: 32670 SIG: 9
Lost connection to device.

Flutter doctor -v

[✓] Flutter (Channel stable, 3.0.1, on macOS 12.0.1 21A559 darwin-arm, locale en-US)
    • Flutter version 3.0.1 at /Users/gcalbi/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (4 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/gcalbi/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: /Users/gcalbi/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7935034/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

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

[✓] Android Studio (version 2020.3)
    • Android Studio at /Users/gcalbi/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7935034/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.10+0-b96-7249189)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Users/gcalbi/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/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.10+0-b96-7249189)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.3)
    • IntelliJ at /Users/gcalbi/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 68.1.3
    • Dart plugin version 213.7371

[✓] IntelliJ IDEA Community Edition (version 2021.2)
    • IntelliJ at /Users/gcalbi/Library/Application Support/JetBrains/Toolbox/apps/IDEA-C/ch-0/212.4746.92/IntelliJ IDEA CE.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.3)
    • IntelliJ at /Users/gcalbi/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.7172.25/IntelliJ IDEA.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.1)
    • IntelliJ at /Users/gcalbi/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/213.6461.79/IntelliJ IDEA.app
    • 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

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

[✓] Connected device (3 available)
    • Pixel 3 (mobile) • 192.168.1.70:40515 • android-arm64  • Android 12 (API 31)
    • macOS (desktop)  • macos              • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
    • Chrome (web)     • chrome             • web-javascript • Google Chrome 102.0.5005.61

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

• No issues found!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processc: regressionIt was better in the past than it is nowcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.customer: money (g3)found in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: mapsGoogle Maps pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions