I cannot force the latest renderer to work with certain API levels on the emulator with the following code:
MapsInitializer.initialize(applicationContext, MapsInitializer.Renderer.LATEST, this)
With API level 30, I can get the latest renderer working.
Google Play services client version: 18020000
Google Play services package version: 231715037
Google Play services maps renderer version(maps_core): 231112103
With API level 34, I am forced to use legacy renderer:
Google Play services client version: 18020000
Google Play services package version: 231818044
Google Play services maps renderer version(legacy): 203115000
Both of these devices are setup the exact same except for the API level. To me, this seems backwards, that a newer Android version is causing the app to use the older renderer.
I created my app using the Google Maps Views Activity wizard
class MapsActivity : AppCompatActivity(), OnMapReadyCallback, OnMapsSdkInitializedCallback {
private lateinit var mMap: GoogleMap
private lateinit var binding: ActivityMapsBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
MapsInitializer.initialize(applicationContext, MapsInitializer.Renderer.LATEST, this)
binding = ActivityMapsBinding.inflate(layoutInflater)
setContentView(binding.root)
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
val mapFragment = supportFragmentManager
.findFragmentById(R.id.map) as SupportMapFragment
mapFragment.getMapAsync(this)
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
override fun onMapReady(googleMap: GoogleMap) {
mMap = googleMap
val coordinates = LatLng(39.999495, -83.012685)
mMap.addMarker(MarkerOptions().position(coordinates).title("Marker"))
mMap.moveCamera(CameraUpdateFactory.newLatLng(coordinates))
}
override fun onMapsSdkInitialized(renderer: MapsInitializer.Renderer) {
when (renderer) {
MapsInitializer.Renderer.LATEST -> Log.d("MapsDemo", "The latest version of the renderer is used.")
MapsInitializer.Renderer.LEGACY -> Log.d("MapsDemo", "The legacy version of the renderer is used.")
}
}
}