mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.35k stars 1.33k forks source link

[Android] MapBox Search Bar Crashes When Letters are Typed into it #16497

Open RSiddiqui99 opened 4 years ago

RSiddiqui99 commented 4 years ago

Hey everyone,

I am using the Google Maps API for the map portion of my app, and MapBox for the search bar, and autocomplete suggestions when the user types into the bar. I've followed this documentation so far. https://blog.mapbox.com/in-app-search-for-android-8b18234656f1

But when I run my program, the search bar does appear, but whenever anything is typed into it my app crashes.

This is what the search bar before clicking on it looks like (The search bar object that I made): https://imgur.com/O8Z9xZQ

After clicking the bar and the MapBox Search Bar appears: https://imgur.com/srVtWRf

Build Gradle: https://imgur.com/WTsFUnF

Error: https://imgur.com/zeJYEEB

Code:

Activity Launch: Mapbox.getInstance(getApplicationContext(), "My key");

After clicking search bar: public void onClick(View v)
{

            Intent intent = new PlaceAutocomplete.IntentBuilder().accessToken(Mapbox.getAccessToken()).build(GoogleMapsActivity.this);
            startActivityForResult(intent, 8888);
        }
    });`

OnActivityResult: if (requestCode==8888 && resultCode==RESULT_OK) { CarmenFeature feature = PlaceAutocomplete.getPlace(data); locateSearchResult(feature.address()); }

Expected Behavior: Search bar provides suggestions when letters are typed into it Actual Behavior: App crashes when letters are typed into search bar

Thank you