Closed WuMianzhi closed 1 week ago
Im the beginner in android develop, when i use maplibre in my app, just follow the step in started-guide , and i cant init and hints
the result just like this:
but it could be loaded normal in real device.
here is my code, please help me
in MainActivity.java
super.onCreate(savedInstanceState); Log.d("TAG", "onCreate: " + checkOpenGLESVersion(this)); // Using MapView requires calling MapLibre.getInstance() before inflating or creating the view. MapLibre.getInstance(this); // EdgeToEdge.enable(this); setContentView(R.layout.activity_main); ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> { Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); return insets; }); mapView = findViewById(R.id.mapView); mapView.getMapAsync(mapLibreMap -> { mapLibreMap.setStyle("https://demotiles.maplibre.org/style.json"); double[] padding = new double[]{1.0, 1.0, 1.0, 1.0}; LatLng center = new LatLng(120.0, 30.0); double zoom = 12.0; double tilt = 1.0; double bearing = 90.0; CameraPosition cameraPosition = new CameraPosition(center, zoom, tilt, bearing, padding); mapLibreMap.setCameraPosition(cameraPosition); });
in activity_main.xml
<org.maplibre.android.maps.MapView android:id="@+id/mapView" android:layout_width="match_parent" android:layout_height="match_parent" />
Im the beginner in android develop, when i use maplibre in my app, just follow the step in started-guide , and i cant init and hints![image](https://github.com/maplibre/maplibre-native/assets/50816246/976df61f-c5ba-4d49-80ca-bef7592de84d)
the result just like this:![image](https://github.com/maplibre/maplibre-native/assets/50816246/9023d72e-e3d7-407c-9133-6a9f6ae0aef8)
but it could be loaded normal in real device.
here is my code, please help me
in MainActivity.java
in activity_main.xml