mapbox / mapbox/mapbox-plugins-android

Simbol manager Error in Mapbox api

Open
#1,131 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
242
Forks
116
PR merge metrics
No merged PRs in 30d

Description

Logcat Error

2020-01-01 15:25:41.098 31695-31695/com.tikrosoft.mapboxtesting E/Mbgl-MapChangeReceiver: Exception in onDidFinishLoadingStyle
java.lang.BootstrapMethodError: Exception from call site #0 bootstrap method
at com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager.(AnnotationManager.java:87)
at com.mapbox.mapboxsdk.plugins.annotation.SymbolManager.(SymbolManager.java:79)
at com.mapbox.mapboxsdk.plugins.annotation.SymbolManager.(SymbolManager.java:56)
at com.mapbox.mapboxsdk.plugins.annotation.SymbolManager.(SymbolManager.java:44)
at com.tikrosoft.mapboxtesting.MainActivity$onCreate$1$onMapReady$1.onStyleLoaded(MainActivity.kt:51)
at com.mapbox.mapboxsdk.maps.MapboxMap.notifyStyleLoaded(MapboxMap.java:889)
at com.mapbox.mapboxsdk.maps.MapboxMap.onFinishLoadingStyle(MapboxMap.java:213)
at com.mapbox.mapboxsdk.maps.MapView$MapCallback.onDidFinishLoadingStyle(MapView.java:1268)
at com.mapbox.mapboxsdk.maps.MapChangeReceiver.onDidFinishLoadingStyle(MapChangeReceiver.java:198)
at com.mapbox.mapboxsdk.maps.NativeMapView.onDidFinishLoadingStyle(NativeMapView.java:1054)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:326)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:6825)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:497)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Mainactivity Code

class MainActivity : AppCompatActivity() {

private var symbolManager: SymbolManager?=null
private val symbols: List<Symbol> = ArrayList()

private lateinit var map: MapboxMap
private lateinit var mapView: MapView
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    Mapbox.getInstance(getApplicationContext(), getString(R.string.mapbox_access_token))
    setContentView(R.layout.activity_main)

    mapView = findViewById(R.id.mapView)
    mapView.onCreate(savedInstanceState)
    mapView.getMapAsync(object : OnMapReadyCallback{

        override fun onMapReady(mapboxMap: MapboxMap) {


            mapboxMap.setStyle(Style.MAPBOX_STREETS,object : Style.OnStyleLoaded{

                override fun onStyleLoaded(style: Style) {

                    map=mapboxMap
                    style.addImage("Me", BitmapFactory.decodeResource(getResources(),R.drawable.custom_marker))
                    symbolManager = SymbolManager(mapView, mapboxMap, style)
                    symbolManager?.iconAllowOverlap = true
                   symbolManager?.textAllowOverlap = false

                }

            })
        }

    })
    button2.setOnClickListener{

        movetoUserLocation()
    }



}

private fun movetoUserLocation() {

    map.animateCamera(CameraUpdateFactory.newLatLngZoom(LatLng(33.637,73.062),15.0))

}

override fun onStart() {
    super.onStart()
    mapView.onStart()
}

override fun onResume() {
    super.onResume()
    mapView.onResume()
}

override fun onPause() {
    super.onPause()
    mapView.onPause()
}

override fun onStop() {
    super.onStop()
    mapView.onStop()
}

override fun onSaveInstanceState(outState: Bundle) {
    super.onSaveInstanceState(outState)
    mapView.onSaveInstanceState(outState)
}

override fun onLowMemory() {
    super.onLowMemory()
    mapView.onLowMemory()
}

override fun onDestroy() {
    super.onDestroy()
    mapView.onDestroy()
}

can anyone tell me why i m getting this error
Thanks in advance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin at MainActivity.kt:51, where SymbolManager is constructed, then trace AnnotationManager.java:87 and the onDidFinishLoadingStyle callback shown in MapChangeReceiver.java. Reproduce the BootstrapMethodError with the displayed style-loading flow; done means identifying the cause and documenting a verified resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.