1

I'm following the Google Maps documentation and I'm getting this error. I just want to know what am I doing worng

SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);

This is the error

'inconvertible types cannot cast android.support.v4.app.fragment'

I'm getting this error as soon as the Google Maps Activity is created by default. Have spent 3 days working on it but still not able to find any solution to this petty problem.

Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77
martin
  • 11
  • 1

1 Answers1

1

In the new Google Play services play-services-maps:17.0.0:

Google Maps from version 17.0.0 has switched to AndroidX. Which means SupportMapFragment now extends androidx.fragment.app.Fragment, not the Support Library equivalent.

Warning: This release is a MAJOR version update and breaking change.

You need to either switch back to 16.1.0 or migrate your app to AndroidX.

Community
  • 1
  • 1
Rahul Khurana
  • 8,577
  • 7
  • 33
  • 60