GithubHelp home page GithubHelp logo

mapbox / mapbox-search-android Goto Github PK

View Code? Open in Web Editor NEW
27.0 82.0 7.0 16.72 MB

Android SDK for Mapbox Search including preconfigured UI

Home Page: https://docs.mapbox.com/android/search/guides/

License: Other

Kotlin 96.39% Java 1.95% Python 0.89% Shell 0.78%
in-scope priority

mapbox-search-android's Introduction

Mapbox Search SDK

codecov

Table of contents

Overview

The Mapbox Search SDK is a developer toolkit to add location search on mobile devices. With the same speed and scale of the Mapbox Search API, the SDK is built specifically for on-demand and local search use cases, like ride-share, food delivery, and store finders apps. Whether your users are trying to find a place among the vast amount of data on a global map, or to find the exact location of a venue a few miles down the road, the Search SDK provides location search for countries all over the globe, in many different languages.

Previously, implementing search into your application required custom tuning with every API request to set a language, location biasing, and result types. There was no pre-built UI and no option for a user to see their search history, or save favorites.

The Mapbox Search SDK allows you to drop pre-tuned search into your application, removing the complexity of API configuration, while still giving you control to customize. It ships with an optional UI framework, or you can build a completely custom implementation with your own UI elements by using the core library. The Search SDK is pre-configured for autocomplete, local search biasing, and includes new features like category search, search history, and search favorites.

Main features

  • Easy-to-use pre-tuned search options to integrate search into your app quickly.
    • Local search for a specific address or POI
  • Pre-configured and customizable category search for popular categories like cafes, ATMs, hotels, and gas stations.
  • Offline search (private beta)
  • Address Autofill
  • On-device user search history
  • On-device favorites
  • Import/export customer data with your own protocols
  • Provide you own persistent providers for customer data like History or Favorites

Visit Search SDK documentation page for more information.

Setup environment

Below are listed the versions on which everything is going to work fine. Other versions might work as well but wasn't tested yet.

  • Android Studio
  • Java 11

Configure credentials

Before installing the SDK, you will need to gather two pieces of sensitive information from your Mapbox account. If you don't have a Mapbox account: sign up and navigate to your Account page. You'll need:

  1. A public access token: From your account's tokens page, you can either copy your default public token or click the Create a token button to create a new public token.
  2. A secret access token with the Downloads:Read scope.

Export your public token as an environment variable MAPBOX_ACCESS_TOKEN and your secret access token as an environment variable SDK_REGISTRY_TOKEN. Alternatively, you can provide those credentials as project properties.

Sample code

Examples for Mapbox Search SDK for Android are available here.

Custom dictionary

Don't forget to add custom dictionary file located at AndroidStudio/dictionary.dic to Android Studio: Preferences -> Editor -> Spelling -> Add custom dictionaries. Update this file with correct words that are not contained in the default dictionary of Android Studio.

Codestyle

We use ktlint for checking Kotlin codestyle and formatting.

To run ktlint checks locally:

cd MapboxSearch
./gradlew :sdk:ktlint

To run ktlint formatter:

./gradlew :sdk:ktlintFormat

Also we have custom codestyle settings for XML. To apply those settings, please, select AndroidStudio/code_style.xml file in Android Studio: Preferences -> Editor -> Code style -> XML -> "gear button" -> Import Scheme.

For any resource name we use prefix mapbox_search_sdk or MapboxSearchSdk depending on resource type according to official Google recommendations: Android library creation recommendations

Code analysis

We use detekt as static code analyzer.

To run detekt locally:

cd MapboxSearch
./gradlew :sdk:detekt

Public API changes tracking

We use binary-compatibility-validator and Metalava for tracking binary and source compatibility of the APIs we ship.

Also we use special Gradle task to generate public.xml file, which helps us track changes in public API of Android values/ resources. Please note that not every values/ resource is tracked, so if you want to add extra resources under the radar, please, specify file contatining these resources manually in mentioned Gradle task.

To check whether your change affects public API, run public-api.sh script with --check argument:

cd MapboxSearch
../scripts/public-api.sh --check

If your change implies changes to the public API, run public-api.sh script with --update argument:

cd MapboxSearch
../scripts/public-api.sh --update

Metalava update guide

If you want to update Metalava, please, use update_metalava.sh script. This scripts places the latest metalava.jar into MapboxSearch/metalava folder and prints out its deps:

./scripts/update_metalava.sh
Cloning… Done
Building… Done

Dependencies:

com.android.tools.external.org-jetbrains:uast:27.2.0-alpha11
com.android.tools.external.com-intellij:kotlin-compiler:27.2.0-alpha11
com.android.tools.external.com-intellij:intellij-core:27.2.0-alpha11
com.android.tools.lint:lint-api:27.2.0-alpha11
com.android.tools.lint:lint-checks:27.2.0-alpha11
com.android.tools.lint:lint-gradle:27.2.0-alpha11
com.android.tools.lint:lint:27.2.0-alpha11
com.android.tools:common:27.2.0-alpha11
com.android.tools:sdk-common:27.2.0-alpha11
com.android.tools:sdklib:27.2.0-alpha11
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.30
org.jetbrains.kotlin:kotlin-reflect:1.4.30
org.ow2.asm:asm:8.0
org.ow2.asm:asm-tree:8.0

Copy and paste (update) the new deps into gradle/metalava-dependencies.gradle

Notes about Japicmp usage

Japicmp is a library, that helps you to determine the differences between the Java .class files, contained in two given .jar archives. Also, this library provides HTML reports with detailed information about each class/method that has been changed.

To use this tool, follow this steps:

  1. Uncomment include ':gradle:japicmp' line in MapboxSearch/settings.gradle;
  2. Open MapboxSearch/gradle/japicmp/build.gradle and make sure:
    • baseline targets to the latest mapbox-search-android (or mapbox-search-android-ui) artifact;
    • latest targets to project(path: ':sdk', configuration: 'default') (or project(path: ':ui', configuration: 'default')).
  3. Run ./gradlew :gradle:japicmp:japicmp task. If breaking changes have been found, you'll see Gradle failure and a link to HTML report in the output.

Testing

We use Kotlin Test DSL for unit tests. Kotlin Test DSL provides human-readable DSL and is based on JUnit 5 dynamic tests. To run unit tests use the following commands:

./gradlew :sdk:testReleaseUnitTest
./gradlew :ui:testReleaseUnitTest
./gradlew :sdk-common:testReleaseUnitTest

Search SDK also contains a bunch of instrumentation and UI tests. To run them, please, use the following command:

./gradlew connectedAndroidTest mergeAndroidReports --continue

We use pitest for mutation testing. To run pitest, execute the following commands:

cd MapboxSearch
./gradlew :sdk:pitestDebug

You can find report at MapboxSearch/sdk/build/reports.

Offline integration tests

To run offline integration tests, please, make sure your MAPBOX_ACCESS_TOKEN has offline_search feature flag enabled. As for now, offline functionality (including offline tests) is in a private beta and available to selected customers only.

Complex checks run

To run all checks and unit tests locally, execute local_checks.sh script:

./scripts/local_checks.sh

Add --runInstrumentationTests flag to also run instrumentation and UI tests. In this case only one running emulator should be available via adb.

Documentation

Public Search SDK documentation.

We use dokka for top level public classes overview. To generate docs for all modules use the following command:

./scripts/generate_docs.sh

You can find generated docs in MapboxSearch/build/generated-docs/ directory.

Third-party SDKs license

Project's additional 3rd-party licences, used by the SDK module and by the UI module, are stored here.

To update license file, please, run python scripts/license-generate.py from the project's root directory. To validate current license file, please, run python scripts/license-validate.py from the project's root directory.

Contributing

We welcome feedback and code contributions!

If you found a bug in Android SDK open a github issue. General feedback is welcoming in the search-sdk repo.

Code of Conduct

Our Standards

Examples of behavior that contributes to creating a positive environment include:

  • Using welcoming and inclusive language.
  • Being respectful of differing viewpoints and experiences.
  • Gracefully accepting constructive criticism.
  • Focusing on what is best for the community.
  • Showing empathy towards other community members.

We recommend reading this blog post from Github on writing great PRs..

Versioning

We use SemVer for versioning.

mapbox-search-android's People

Contributors

ahmedaly16 avatar dzmitryfomchyn avatar eugenes78 avatar globaltrouble avatar iamgreut avatar kalbaxa avatar mikeringrose avatar sbma44 avatar thibaudlopez avatar tobrun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapbox-search-android's Issues

Libray not working com.mapbox.navigation

Environment

  • Android OS version:
  • Devices affected:
  • Search SDK Version: 1.0.0-beta.24
  • Included in project Maps SDK, Nav SDK versions if available:
    Navigation SDK : 2.1.1

Code examples

implementation "com.mapbox.navigation:android:2.1.1" implementation "com.mapbox.search:mapbox-search-android-ui:1.0.0-beta.24"

Observed behavior and steps

2021-12-29 16:07:59.455 12256-12256/com.sfl.navigationsystem E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sfl.navigationsystem, PID: 12256
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN6mapbox6common9Scheduler15CreateSequencedEv" referenced by "/data/app/~~5nk1-hA9Bps7Tya4d_wTmg==/com.sfl.navigationsystem-XaTGAx2k2VmsrKVNyxtalg==/lib/arm64/libnavigator-android.so"...
at android.app.ActivityThread.installProvider(ActivityThread.java:7285)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6821)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6716)
at android.app.ActivityThread.access$1300(ActivityThread.java:238)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7698)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
Caused by: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN6mapbox6common9Scheduler15CreateSequencedEv" referenced by "/data/app/~~5nk1-hA9Bps7Tya4d_wTmg==/com.sfl.navigationsystem-XaTGAx2k2VmsrKVNyxtalg==/lib/arm64/libnavigator-android.so"...
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:162)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:198)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:38)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
at android.app.ActivityThread.installProvider(ActivityThread.java:7280)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6821) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6716) 
at android.app.ActivityThread.access$1300(ActivityThread.java:238) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7698) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952) 
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN6mapbox6common9Scheduler15CreateSequencedEv" referenced by "/data/app/~~5nk1-hA9Bps7Tya4d_wTmg==/com.sfl.navigationsystem-XaTGAx2k2VmsrKVNyxtalg==/lib/arm64/libnavigator-android.so"...
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.mapbox.common.loader.MapboxLibraryLoader.load(MapboxLibraryLoader.kt:19)
at com.mapbox.navigator.MapboxNavigationNativeInitializer.create(MapboxNavigationNativeInitializer.kt:16)
at com.mapbox.navigator.MapboxNavigationNativeInitializer.create(MapboxNavigationNativeInitializer.kt:10)
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:155)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:198) 
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:38) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:2388) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:2358) 
at android.app.ActivityThread.installProvider(ActivityThread.java:7280) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6821) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6716) 
at android.app.ActivityThread.access$1300(ActivityThread.java:238) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7698) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952) 

Expected behavior

Should work with navigation SDK

PR #192 merged without review (mapbox-search-android)

👋 Hey there! It's Changebot, and I help repositories follow our engineering best practices. My magic wand found some things I wanted to highlight for your review:

Item Current status Best practice guidelines
Pull request state at time of merging Without review Approving review before merging
Merged by @eugenes78

The following pull request was merged without a review: #192

Can you take a look at these best practices and make any adjustments if needed?

Please tag @mapbox/security-and-compliance on this issue if you have any questions

SDK results different from playground?

What

The SDK and the playground results are not the same despite setting the same parameters.

Workaround

The language parameter is set automatically in the SDK. To remove this, set var emptyLangs = arrayListOf<Language>() such that:

var emptyLangs = arrayListOf<Language>()
val list = arrayListOf<QueryType>()
list.add(QueryType.PLACE)
searchRequestTask = searchEngine.search(
    "Foo",
    SearchOptions(
        languages = emptyLangs,
        limit = 10,
        types = list,
    ),
    searchCallback
)

Duplicate class found

When I use the map with the search engine:

implementation 'com.mapbox.maps:android:10.4.2'
implementation 'com.mapbox.search:mapbox-search-android:1.0.0-beta.41'

I get a Duplicate class found error when building the project:

Duplicate class com.mapbox.android.core.location.LocationEngine found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0) Duplicate class com.mapbox.android.core.location.LocationEngineCallback found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0) Duplicate class com.mapbox.android.core.location.LocationEngineProvider found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0) Duplicate class com.mapbox.android.core.location.LocationEngineRequest found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0) Duplicate class com.mapbox.android.core.location.LocationEngineRequest$Builder found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0) Duplicate class com.mapbox.android.core.location.LocationEngineResult found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0) Duplicate class com.mapbox.android.core.permissions.PermissionsListener found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0) Duplicate class com.mapbox.android.core.permissions.PermissionsManager found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0) Duplicate class com.mapbox.android.core.permissions.PermissionsManager$AccuracyAuthorization found in modules jetified-common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and jetified-mapbox-android-core-5.0.0-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.0)

private fun com.mapbox.search.result.SearchAddress.isCountryWithRegions(country: String?): Boolean does not work for "United States"

Environment

  • Android OS version: All versions
  • Devices affected: All devices
  • Search SDK Version: 1.0.0-beta.33
  • Included in project Maps SDK, Nav SDK versions if available: Mapbox SDK 10.6.1

Code examples

    private fun isCountryWithRegions(country: String?): Boolean = country?.let {
        listOf("united states of america", "usa").contains(country.lowercase(Locale.getDefault()))
    } ?: false

    fun main() {
        val result = isCountryWithRegions("United States")
        print (result) // returns false because "United States"/"united states" does not contain either "united states of america" or "usa".
    }

Observed behavior and steps

Because of this, Search results with the country "United States" will not show the region with the default FormatStyle.Medium. E.g. "17537 Fernwood Drive, Jamestown, California" will just be "17537 Fernwood Drive, Jamestown".

Expected behavior

The region will be included.

Can I help provide data for my city to the search database? / Могу ли я помочь предоставить данные по моему городу в базу данных поиска?

Good afternoon, I am developing an application in the city of Ulan-Ude, can I help with providing data to the search system in my city? /
Добрый день я разрабатываю приложение в городе Улан-Удэ могу ли я помочь с предоставление данных в систему поиска по моему городу?

Unfortunately for my city, there are practically no bindings for the coordinates of both streets and certain places. /
К несчастью для моего города практически нет привязок координат как улиц так и определённых мест.

But in the application you can Mapbox Maps SDK, the names of some places in the city and streets are perfectly visible. /
Но в приложении можно Mapbox Maps SDK прекрасно видны наименования некоторых мест города и улиц.

Can I help to provide street data and its end, or house data (Street , House (Latitude,Longitude) ) ? /
Могу помочь предоставить данные улиц и их конец, или данные домов (Улица , Дом (Latitude,Longitude) ) ?

I will also need to know the best language to provide information /
Мне также потребуется, узнать на каком языке лучше предоставлять информацию

With Mapbox SDK just started working
The application is very well developed and ready to help if possible. /
C Mapbox SDK начал работать совсем недавно
Приложение очень хорошо развивается готов помочь если возможно.

Thank you, I hope for a speedy reply. / Спасибо, надеюсь на скорый ответ.

Reverse geocoding doesn't return address number

Environment

  • Android OS version: 12
  • Devices affected: Development device
  • Search SDK Version: 1.0.0-beta-37
  • Included in project Maps SDK, Nav SDK versions if available:

Code examples

    override suspend fun getAddressFromPoint(point: Point): Either<Failure, List<SearchResult>> {
        return suspendCoroutine { continuation ->
            mapBoxSearchEngine.search(
                ReverseGeoOptions(
                    center = point,
                    limit = SEARCH_LIMIT,
                    types = SEARCH_TYPES
                ),
                object : SearchCallback {
                    override fun onError(e: Exception) {
                        if (e is SearchCancellationException) {
                            Timber.d("Search was cancelled due to new point [point=$point]")
                            continuation.resumeWith(Result.success(Either.Left(CancellationError)))
                        } else {
                            Timber.w(e, "Reverse Geocoding failure [point=$point]")
                            continuation.resumeWith(
                                Result.success(Either.Left(MapBoxError.GeocodingError))
                            )
                        }
                    }

                    override fun onResults(
                        results: List<SearchResult>,
                        responseInfo: ResponseInfo
                    ) {
                        continuation.resumeWith(Result.success(Either.Right(results)))
                    }
                }
            )
        }
    }

Observed behavior and steps

Running the above code for any given point, returns the address but NOT the address' number. Reverse Geocoding via MapBox's API returns the address number as well.

Expected behavior

The reverse geocoding function to return the address number along with the address.

SearchRequestException caused by valid city and postal code query.

Environment

  • Android OS version:
  • Devices affected:
  • Search SDK Version: V1.0.0-beta.22
  • Included in project Maps SDK, Nav SDK versions if available: mapbox-android-sdk V9.6.1

Code examples

Our querySuggestion() method:

return withContext(dispatchers.main()) {
            suspendCancellableCoroutine { cont ->
                val callback = object : SearchSelectionCallback {
                    override fun onCategoryResult(
                        suggestion: SearchSuggestion,
                        results: List<SearchResult>,
                        responseInfo: ResponseInfo,
                    ) = Unit

                    override fun onResult(
                        suggestion: SearchSuggestion,
                        result: SearchResult,
                        responseInfo: ResponseInfo,
                    ) = Unit

                    override fun onError(e: Exception) = cont.resume(Err(e))

                    override fun onSuggestions(suggestions: List<SearchSuggestion>, responseInfo: ResponseInfo) {
                        cont.resume(Ok(suggestions))
                    }
                }
                searchTask?.cancel()
                val options = proximity?.let { searchOptions.copy(proximity = it) } ?: searchOptions
                searchTask = mapboxPlaceSearch.search(query.toString(), options, callback)
            }
        }

Screen recording of the phone:
searchRequestException1.mp4.zip

Observed behavior and steps

The app doesn't crash so that's good, but even with a valid city and postal code(I verified the city and postal code with https://docs.mapbox.com/playground/geocoding/) causes the exception below at SearchSelectionCallback > onError().

SearchRequestException(message='Unknown', code=422, cause=null)
        at com.mapbox.search.core.http.HttpClientImpl$makeRequest$1.onResponse(HttpClientImpl.kt:51)
        at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)

Expected behavior

As user types letters or numbers into the search field, it should populate and show a list of suggestions.

Branch protection on main not adhering to best practices

👋 Hey there! It's Changebot, and I help repositories follow our engineering best practices. My magic wand found some things I wanted to highlight for your review:

Item Current status Best practice guidelines
main branch protection: Dismiss stale pull request approvals when new commits are pushed Unchecked Checked
main branch protection: Restrict who can push to this branch Unchecked Checked

Can you take a look at these best practices and make any adjustments if needed?

Please tag @mapbox/security-and-compliance on this issue if you have any questions

Crash in production: java.lang.UnsatisfiedLinkError: dlopen failed: library "libmapbox-common.so" not found

Environment

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • Offline Search SDK (OfflineSearchEngine class, and etc.)
    • Address Autofill SDK
    • Search UI SDK
  • Android OS version: 11
  • Devices affected: Vivo S1, rooted
  • Search SDK Version: 1.0.0-rc.4
  • Included in project Maps SDK, Nav SDK versions if available:

Code examples

Code where we use Search SDK:

suspend fun resolveAddress(latitude: Double, longitude: Double): List<SearchResult> {
        val options = ReverseGeoOptions(
            center = Point.fromLngLat(longitude, latitude)
        )

        return geocodingSearchEngine.search(options)
    }

internal suspend fun SearchEngine.search(
    options: ReverseGeoOptions
): List<SearchResult> =
    suspendCancellableCoroutine { continuation ->
        val task = search(
            options,
            object : SearchCallback {
                override fun onError(e: Exception) {
                    if (continuation.isCancelled) {
                        return
                    }
                    continuation.resumeWithException(e)
                }

                override fun onResults(results: List<SearchResult>, responseInfo: ResponseInfo) {
                    continuation.resume(results)
                }
            }
        )

        continuation.invokeOnCancellation {
            task.cancel()
        }
    }

Observed behavior and steps

App crashes on start for 1 user in Crashlytics. It may be the delivery error by the Play Store (it didn't include necessary SO file into the APK during an install) or SDK error (necessary SO is not available for the given architecture, which is unlikely)

Stacktrace:

# Crashlytics - Stack trace
# Application: com.gasanmamo.claims
# Platform: android
# Version: 1.0.6 (13)
# Issue: 513ffd6894244f60388c2500fa974886
# Session: 64B4AB1A031D00010E38BB1596302A83_DNE_0_v2
# Date: Mon Jul 17 2023 05:44:42 GMT+0300 (Eastern European Summer Time)

Fatal Exception: java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: m5.c: m5.c: m5.c: java.lang.UnsatisfiedLinkError: dlopen failed: library "libmapbox-common.so" not found
       at android.app.ActivityThread.installProvider(ActivityThread.java:7289)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6825)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6739)
       at android.app.ActivityThread.access$1300(ActivityThread.java:241)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7702)
       at java.lang.reflect.Method.invokeImpl(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:425)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:617)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:948)

Caused by m5.c: m5.c: m5.c: java.lang.UnsatisfiedLinkError: dlopen failed: library "libmapbox-common.so" not found
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:98)
       at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:81)
       at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:50)
       at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:50)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
       at android.app.ActivityThread.installProvider(ActivityThread.java:7284)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6825)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6739)
       at android.app.ActivityThread.access$1300(ActivityThread.java:241)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7702)
       at java.lang.reflect.Method.invokeImpl(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:425)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:617)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:948)

Caused by m5.c: m5.c: java.lang.UnsatisfiedLinkError: dlopen failed: library "libmapbox-common.so" not found
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:98)
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:77)
       at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:81)
       at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:50)
       at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:50)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
       at android.app.ActivityThread.installProvider(ActivityThread.java:7284)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6825)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6739)
       at android.app.ActivityThread.access$1300(ActivityThread.java:241)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7702)
       at java.lang.reflect.Method.invokeImpl(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:425)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:617)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:948)

Caused by m5.c: java.lang.UnsatisfiedLinkError: dlopen failed: library "libmapbox-common.so" not found
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:98)
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:77)
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:77)
       at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:81)
       at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:50)
       at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:50)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
       at android.app.ActivityThread.installProvider(ActivityThread.java:7284)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6825)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6739)
       at android.app.ActivityThread.access$1300(ActivityThread.java:241)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7702)
       at java.lang.reflect.Method.invokeImpl(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:425)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:617)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:948)

Caused by java.lang.UnsatisfiedLinkError: dlopen failed: library "libmapbox-common.so" not found
       at java.lang.Runtime.loadLibrary0(Runtime.java:1107)
       at java.lang.Runtime.loadLibrary0(Runtime.java:1028)
       at java.lang.System.loadLibrary(System.java:1664)
       at com.mapbox.common.loader.MapboxLibraryLoader.load(:5)
       at com.mapbox.common.CoreInitializer.create(CoreInitializer.java:1)
       at com.mapbox.common.CoreInitializer.create(CoreInitializer.java:2)
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:85)
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:77)
       at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:77)
       at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:81)
       at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:50)
       at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:50)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
       at android.app.ActivityThread.installProvider(ActivityThread.java:7284)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6825)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6739)
       at android.app.ActivityThread.access$1300(ActivityThread.java:241)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7702)
       at java.lang.reflect.Method.invokeImpl(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:425)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:617)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:948)

Firebase Blocking Thread #0:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
       at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
       at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
       at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:978)
       at java.lang.Thread.run(Thread.java:923)

ReferenceQueueDaemon:
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:442)
       at java.lang.Object.wait(Object.java:568)
       at java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:217)
       at java.lang.Daemons$Daemon.run(Daemons.java:139)
       at java.lang.Thread.run(Thread.java:923)

Firebase Blocking Thread #1:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
       at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
       at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
       at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:978)
       at java.lang.Thread.run(Thread.java:923)

Measurement Worker:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1063)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1358)
       at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278)
       at com.google.android.gms.tasks.zzad.zzb(zzad.java:40)
       at com.google.android.gms.tasks.Tasks.await(Tasks.java:40)
       at com.google.firebase.analytics.FirebaseAnalytics.getFirebaseInstanceId(FirebaseAnalytics.java:10)
       at java.lang.reflect.Method.invokeImpl(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:425)
       at com.google.android.gms.measurement.internal.zzel.zzj(zzel.java:546)
       at com.google.android.gms.measurement.internal.zzjy.zzO(zzjy.java:546)
       at com.google.android.gms.measurement.internal.zzjy.zzu(zzjy.java:7)
       at com.google.android.gms.measurement.internal.zzge.zzH(zzge.java:2068)
       at com.google.android.gms.measurement.internal.zzgd.run(zzgd.java:2068)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at com.google.android.gms.measurement.internal.zzga.run(zzga.java:47)

FinalizerDaemon:
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:442)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:190)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:211)
       at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:273)
       at java.lang.Daemons$Daemon.run(Daemons.java:139)
       at java.lang.Thread.run(Thread.java:923)

Firebase Background Thread #1:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:978)
       at java.lang.Thread.run(Thread.java:923)

Crashlytics Exception Handler1:
       at dalvik.system.VMStack.getThreadStackTrace(VMStack.java)
       at java.lang.Thread.getStackTrace(Thread.java:1736)
       at java.lang.Thread.getAllStackTraces(Thread.java:1812)
       at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateThreadsList(CrashlyticsReportDataCapture.java:225)
       at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateExecutionData(CrashlyticsReportDataCapture.java:225)
       at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateEventApplicationData(CrashlyticsReportDataCapture.java:225)
       at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.captureEventData(CrashlyticsReportDataCapture.java:225)
       at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistEvent(SessionReportingCoordinator.java:225)
       at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistFatalEvent(SessionReportingCoordinator.java:225)
       at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:225)
       at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:225)
       at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(CrashlyticsBackgroundWorker.java:4)
       at com.google.android.gms.tasks.zze.run(zze.java:274)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:2)
       at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:5)
       at java.lang.Thread.run(Thread.java:923)

Firebase Blocking Thread #3:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
       at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
       at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
       at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:978)
       at java.lang.Thread.run(Thread.java:923)

Firebase Background Thread #2:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:978)
       at java.lang.Thread.run(Thread.java:923)

com.google.firebase.crashlytics.startup1:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:2)
       at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:5)
       at java.lang.Thread.run(Thread.java:923)

Firebase Blocking Thread #2:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
       at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
       at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
       at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:978)
       at java.lang.Thread.run(Thread.java:923)

queued-work-looper:
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:335)
       at android.os.Looper.loop(Looper.java:183)
       at android.os.HandlerThread.run(HandlerThread.java:67)

Firebase Background Thread #3:
       at libcore.io.Linux.openImpl(Linux.java)
       at libcore.io.Linux.open(Linux.java:159)
       at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
       at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254)
       at libcore.io.ForwardingOs.open(ForwardingOs.java:166)
       at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7588)
       at libcore.io.IoBridge.open(IoBridge.java:478)
       at java.io.FileInputStream.<init>(FileInputStream.java:160)
       at com.google.firebase.installations.local.PersistedInstallation.readJSONFromFile(PersistedInstallation.java:15)
       at com.google.firebase.installations.local.PersistedInstallation.readPersistedInstallationEntryValue(PersistedInstallation.java:15)
       at com.google.firebase.installations.FirebaseInstallations.getPrefsWithGeneratedIdMultiProcessSafe(FirebaseInstallations.java:16)
       at com.google.firebase.installations.FirebaseInstallations.doRegistrationOrRefresh(FirebaseInstallations.java:16)
       at com.google.firebase.installations.FirebaseInstallations.lambda$getId$1(FirebaseInstallations.java:13)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:978)
       at java.lang.Thread.run(Thread.java:923)

ScionFrontendApi:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2109)
       at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

Firebase Background Thread #0:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0(CustomThreadFactory.java:978)
       at java.lang.Thread.run(Thread.java:923)

awaitEvenIfOnMainThread task continuation executor1:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:2)
       at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:5)
       at java.lang.Thread.run(Thread.java:923)

pool-7-thread-1:
       at sun.misc.Unsafe.park(Unsafe.java)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

FinalizerWatchdogDaemon:
       at java.lang.Object.wait(Object.java)
       at java.lang.Object.wait(Object.java:442)
       at java.lang.Object.wait(Object.java:568)
       at java.lang.Daemons$FinalizerWatchdogDaemon.sleepUntilNeeded(Daemons.java:341)
       at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:321)
       at java.lang.Daemons$Daemon.run(Daemons.java:139)
       at java.lang.Thread.run(Thread.java:923)

Expected behavior

App starts just fine, initialization happens without issues.

PR #192 merged without successful status checks (mapbox-search-android)

👋 Hey there! It's Changebot, and I help repositories follow our engineering best practices. My magic wand found some things I wanted to highlight for your review:

Item Current status Required? Best practice guidelines
Run unsuccessful: ci/circleci: instrumentation-tests failure required success
Run unsuccessful: publisher-deployer neutral optional success

The following PR was merged without the status checks passing: #192

Can you take a look at these best practices and make any adjustments if needed?

Please tag @mapbox/security-and-compliance on this issue if you have any questions

PR #160 merged without successful status checks (mapbox-search-android)

👋 Hey there! It's Changebot, and I help repositories follow our engineering best practices. My magic wand found some things I wanted to highlight for your review:

Item Current status Best practice guidelines
Run unsuccessful: ci/circleci: instrumentation-tests failure success
Run unsuccessful: publisher-deployer neutral success

The following PR was merged without the status checks passing: #160

Can you take a look at these best practices and make any adjustments if needed?

Please tag @mapbox/security-and-compliance on this issue if you have any questions

Mapbox Search w/ Mapbox v9

Environment

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • Offline Search SDK (OfflineSearchEngine class, and etc.)
    • Address Autofill SDK
    • Search UI SDK
  • Android OS version: Android 13 / API 33
  • Devices affected: tested with a Pixel 6
  • Search SDK Version: 1.0.0-beta.39
  • Included in project Maps SDK, Nav SDK versions if available:
    Mapbox SDK 9.5.0
    Navigation SDK 2.7.0

Code examples

Observed behavior and steps

Observed a crash on App Start with the search core library only imported in buidl.gradle but without using any of it's functions or API.

java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN6mapbox6common13EventsServiceC1EONS0_20EventsServiceOptionsE" referenced by "/data/app/~~SJ1CEMouzZWsBNbKOrhYSg==/de.xxx.yyy.dev-xG9CxLRFRi1L74mF_Fbw8w==/base.apk!/lib/arm64-v8a/libmapbox-maps.so"...

I tried before with 1.0.0-beta.38 which resulted in build issues due to a duplicated class MapboxCommonLogger.

So I assume that the search library only works with Mapbox v10. If there is a way to make it work with v9 please let me know, since i need the search feature very soon and a migration to v10 would take much more effort.

At least it would be nice to add a note on the search documentation page that v10 is required in case.

Thanks in advance

java.lang.UnsatisfiedLinkError: No implementation found for void com.mapbox.maps.assets.AssetManagerProvider.initialize(android.content.res.AssetManager) (tried Java_com_mapbox_maps_assets_AssetManagerProvider_initialize and Java_com_mapbox_maps_assets_AssetManagerProvider_initialize__Landroid_content_res_AssetManager_2)

Environment

  • Android OS version: 12
  • Devices affected: XiaoMi
  • Search SDK Version: 1.0.0-beta.35
  • Included in project Maps SDK, Nav SDK versions if available: Maps SDK:10.7.0

Code examples

Observed behavior and steps

Unable to start activity ComponentInfo{com.xxx.xxx.debug/comxxx.xxx.module.growthmonitor.activity.MapBoxGrowthMonitorActivity}: android.view.InflateException: Binary XML file line #17 in com.xxx.xxx.debug:layout/mapbox_growth_monitor_activity: Binary XML file line #17 in com.xxx.xxx.debug:layout/mapbox_growth_monitor_activity: Error inflating class com.mapbox.maps.MapView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3790)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3957)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:106)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2335)

Expected behavior

SDK is entirely unusable without location permission

New Feature

Make AddressAutofill, PlaceAutocomplete and SearchEngine (all dependent on LocationEngine) work without location permission.

Why

In our app we want to make user's life easier by providing autocompletion, we are not interested in their location at that particular moment. After migration to MapBox SDK we have to respond to complains why autocompletion is not available without giving access to the location. And I think this concern is absolutely reasonable.

Network data provider

From the description it seems that custom data provider must provide all indexable records immediately. Instead I want to query my API based on the input in the search box. Is this scenario supported?

Autofill not work until Number and char is filled

Environment

https://docs.mapbox.com/android/search/guides/address-form-fill/

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • Offline Search SDK (OfflineSearchEngine class, and etc.)
    • Address Autofill SDK
    • Search UI SDK
  • Android OS version: Any
  • Devices affected: Any
  • Search SDK Version: 1.0.0-rc.6 / 1.0.0-rc.7

Code examples

Used code from documentation / sample

Observed behavior and steps

In Europe and many other countries address format is Street space HouseNumber but Autofill suggestion start working after fill Number and Char, not before. So until we fill whole Street number it show: No suggestions found and thats inacceptable!

Compare this two variants:

  • 85 Borivojov
  • Borivojov

I expecting show street from Prague after just a few chars like Boriv) but I don't get any results until I fill first number.

Check the videos:

Screen_recording_20230717_122635.mp4
Screen_recording_20230717_122852.mp4

Expected behavior

Start suggesting street names

Your app uses https://api.mapbox.com/geocoding/v5 to get recommendations after using AddressAutofill, somehow after integrating your modules in my project it uses https://api.mapbox.com/autofill because of that I can't get recommendations to search

Environment

  • Search SDK Component I use .aar files built from your modules without any changes
  • Android OS version: 13
  • Devices affected: pixel
  • Search SDK Version: 0.67.1
  • Included in project Maps SDK, Nav SDK versions if available: MapBox-10.10.0 Navigation-2.11.0

Code examples

Favorite item not persisted between app sessions in SearchPlaceBottomSheetView

Favorite item not persisted between app sessions in SearchPlaceBottomSheetView

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • Offline Search SDK (OfflineSearchEngine class, and etc.)
    • Address Autofill SDK
    • Search UI SDK
  • Android OS version:
  • Devices affected:
  • Search SDK Version: 1.0.0-rc.7
  • Included in project Maps SDK, Nav SDK versions if available:

Favorited item is not remembered in SearchPlaceBottomSheetView once app restarts, I am sorry but do you guys even test this SDK? Core implementation is solid, but these kind of bugs are surprising.

In the list with results it is marked as favorite, but on bottom sheet not, I can add it again to favorites, even though it is already there.

Place Autocomplete 401 error: The feature is not enabled

Environment

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • Offline Search SDK (OfflineSearchEngine class, and etc.)
    • Address Autofill SDK
    • Search UI SDK
  • Android OS version: SDK32
  • Devices affected: Pixel XL API 32
  • Search SDK Version:
    com.mapbox.search:place-autocomplete:1.0.0-rc.1
  • Included in project Maps SDK, Nav SDK versions if available:
    com.mapbox.maps:android:10.11.1
    com.mapbox.navigation:android:2.10.1

Code examples

placeAutocomplete = PlaceAutocomplete.create(accessToken = getString(R.string.mapbox_access_token))
// placeAutocmplete.
queryEditText = findViewById(R.id.query_text)
lifecycleScope.launchWhenCreated {
val response = placeAutocomplete.suggestions(
query = "Washington DC",
)

        response.onValue { suggestions ->
            Log.i("SearchApiExample", "Place Autocomplete results: $suggestions")
        }.onError { e ->
            Log.i("SearchApiExample", "Place Autocomplete error", e)
        }
    }

Observed behavior and steps

I followed the installation steps and this website:
https://docs.mapbox.com/android/search/examples/place-autocomplete-ui/
But apparently Autocomplete always generates this exception:
SearchRequestException(message='{"status_code":401,"error":"The feature is not enabled","version":"63:6196f108d7bac14af1d1b746893a65309aac5867","code":"eJwrLkrWTyzI1M9IzEvJSS0q1i9LzMlMSSxJ1Ssq1jUyswQAx5sLjA=="}', code=401, cause=null)

So I tried a simplified version of the autocomplete feature with this website:
https://docs.mapbox.com/android/search/examples/place-autocomplete/

It generates the same SearchRequestException while my map and GPS work fine:
Screenshot_1677551529

Place Autocomplete error
SearchRequestException(message='{"status_code":401,"error":"The feature is not enabled","version":"63:6196f108d7bac14af1d1b746893a65309aac5867","code":"eJwrLkrWTyzI1M9IzEvJSS0q1i9LzMlMSSxJ1Ssq1jUyswQAx5sLjA=="}', code=401, cause=null)
at com.mapbox.search.base.utils.extension.SearchResponseErrorKt.toPlatformHttpException(SearchResponseError.kt:12)
at com.mapbox.search.base.engine.TwoStepsRequestCallbackWrapper.run$lambda-7(TwoStepsRequestCallbackWrapper.kt:74)
at com.mapbox.search.base.engine.TwoStepsRequestCallbackWrapper.$r8$lambda$O8P2IEYmBlShaf3i-FSXgZSHENQ(Unknown Source:0)
at com.mapbox.search.base.engine.TwoStepsRequestCallbackWrapper$$ExternalSyntheticLambda0.run(Unknown Source:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:920)
2023

Expected behavior

My app does not behave the same as the one shown in the video demo, for both of the sample codes:
https://docs.mapbox.com/android/search/examples/place-autocomplete/
and
https://docs.mapbox.com/android/search/examples/place-autocomplete-ui/

Got an ANR(Application Not Responding) error

Environment

  • Android OS version: 12
  • Devices affected: Samsung Galaxy S10e
  • Search SDK Version: v1.0.0-beta.28
  • Included in project Maps SDK, Nav SDK versions if available: Maps SDK: v9.6.1

Code examples

SDK initialization:

        applicationScope.launch(dispatcher.main()) {
            Mapbox.getInstance(
                this@HatchApplication,
                getString(hatch.features.rewards.R.string.mapbox_access_token),
            )
        }
        applicationScope.launch(dispatcher.io()) {
            MapboxSearchSdk.initialize(
                this@HatchApplication,
                getString(hatch.features.rewards.R.string.mapbox_access_token),
                DefaultLocationProvider(this@HatchApplication)
            )
        }

querySuggestion:

        return withContext(dispatchers.main()) {
            suspendCancellableCoroutine { cont ->
                val callback = object : SearchSelectionCallback {
                    override fun onCategoryResult(
                        suggestion: SearchSuggestion,
                        results: List<SearchResult>,
                        responseInfo: ResponseInfo,
                    ) = Unit

                    override fun onResult(
                        suggestion: SearchSuggestion,
                        result: SearchResult,
                        responseInfo: ResponseInfo,
                    ) = Unit

                    override fun onError(e: Exception) = cont.resume(Err(e))

                    override fun onSuggestions(suggestions: List<SearchSuggestion>, responseInfo: ResponseInfo) {
                        cont.resume(Ok(suggestions))
                    }
                }
                searchTask?.cancel()
                val options = proximity?.let { searchOptions.copy(proximity = it) } ?: searchOptions
                searchTask = mapboxPlaceSearch.search(query.toString(), options, callback)
            }
        }

Observed behavior and steps

run app, wait for app to launch, observes this error on logcat as the app hangs and remains unresponsive.

2022-05-10 11:09:09.114 772-787/? E/ActivityManager: ANR in com.hatchcard.android.debug
    PID: 8787
    Reason: executing service com.hatchcard.android.debug/com.mapbox.android.telemetry.MapboxTelemetryService
    Load: 14.62 / 9.89 / 4.09
    CPU usage from 7613ms to 0ms ago (2022-05-10 11:08:58.758 to 2022-05-10 11:09:06.372):
      9.8% 8102/com.google.android.calendar: 8.9% user + 0.9% kernel / faults: 6720 minor
      2.6% 772/system_server: 1.1% user + 1.4% kernel / faults: 33 minor
      1.1% 8787/com.hatchcard.android.debug: 0.9% user + 0.2% kernel / faults: 119 minor
      0.7% 1505/com.android.systemui: 0.5% user + 0.2% kernel / faults: 27 minor
      0.6% 417/kworker/u16:4: 0% user + 0.6% kernel
      0.5% 432/surfaceflinger: 0.2% user + 0.2% kernel
      0% 5375/kworker/1:3: 0% user + 0% kernel
      0.3% 430/msm_irqbalance: 0.1% user + 0.2% kernel
      0.3% 6121/com.google.android.apps.turbo:aab: 0.2% user + 0.1% kernel / faults: 86 minor
      0.2% 10/rcu_preempt: 0% user + 0.2% kernel
      0.2% 31/kworker/0:1: 0% user + 0.2% kernel
      0.2% 38/kworker/u16:1: 0% user + 0.2% kernel
      0.2% 302/msm-core:sampli: 0% user + 0.2% kernel
      0.2% 426/[email protected]: 0.1% user + 0.1% kernel
      0.2% 484/irq/215-fc38800: 0% user + 0.2% kernel
      0.2% 573/thermal-engine: 0% user + 0.2% kernel
      0.1% 3/ksoftirqd/0: 0% user + 0.1% kernel
      0.1% 15/ksoftirqd/1: 0% user + 0.1% kernel
      0.1% 16/kworker/1:0: 0% user + 0.1% kernel
      0.1% 25/ksoftirqd/3: 0% user + 0.1% kernel
      0% 35/kworker/1:1H: 0% user + 0% kernel
      0.1% 40/kworker/u17:0: 0% user + 0.1% kernel
      0.1% 42/kworker/u17:1: 0% user + 0.1% kernel
      0.1% 161/vsync_retire_wo: 0% user + 0.1% kernel
      0.1% 205/spi5: 0% user + 0.1% kernel
      0.1% 209/kworker/u16:3: 0% user + 0.1% kernel
      0.1% 250/cfinteractive: 0% user + 0.1% kernel
      0.1% 259/mmcqd/0: 0% user + 0.1% kernel
      0.1% 331/ueventd: 0% user + 0.1% kernel
      0.1% 346/kworker/u17:3: 0% user + 0.1% kernel
      0.1% 349/kworker/u17:5: 0% user + 0.1% kernel
      0.1% 368/logd: 0% user + 0.1% kernel
      0.1% 427/healthd: 0% user + 0.1% kernel
      0.1% 431/lmkd: 0% user + 0.1% kernel
      0.1% 564/jbd2/dm-2-8: 0% user + 0.1% kernel
      0.1% 596/wificond: 0% user + 0.1% kernel
      0.1% 2503/com.google.android.gms.persistent: 0.1% user + 0% kernel / faults: 1 minor
      0.1% 3860/com.agilebits.onepassword: 0.1% user + 0% kernel / faults: 1 minor
      0.1% 5386/kworker/0:5: 0% user + 0.1% kernel
      0.1% 6936/kworker/3:3: 0% user + 0.1% kernel
      0.1% 7244/com.google.android.youtube: 0.1% user + 0% kernel
      0.1% 8060/com.google.android.apps.walletnfcrel: 0.1% user + 0% kernel / faults: 1 minor
      0.1% 8592/com.lilly.deloitte.vega: 0.1% user + 0% kernel / faults: 4 minor
      0.1% 8856/com.google.android.gms.unstable: 0.1% user + 0% kernel / faults: 10 minor
    3% TOTAL: 1.7% user + 0.8% kernel + 0% iowait + 0.3% softirq
    CPU usage from 79ms to 499ms later (2022-05-10 11:09:06.450 to 2022-05-10 11:09:06.870):
      36% 772/system_server: 12% user + 24% kernel / faults: 403 minor
        39% 787/ActivityManager: 15% user + 24% kernel
        3% 772/system_server: 3% user + 0% kernel
      2.4% 44/irq/51-cpr: 0% user + 2.4% kernel
      2.6% 259/mmcqd/0: 0% user + 2.6% kernel
      3.1% 2503/com.google.android.gms.persistent: 0% user + 3.1% kernel / faults: 1 minor
        3.1% 2503/.gms.persistent: 0% user + 3.1% kernel
      3.9% 8787/com.hatchcard.android.debug: 3.9% user + 0% kernel
        3.9% 8815/plumber-android: 3.9% user + 0% kernel
    7.8% TOTAL: 2.7% user + 5.1% kernel
2022-05-10 11:09:27.066 772-792/? E/BatteryExternalStatsWorker: no controller energy info supplied for bluetooth
2022-05-10 11:10:27.016 2503-3356/? E/baqn: Phenotype API error. Event # cvpe@65c4bb15, EventCode: 5 [CONTEXT service_id=51 ]
    bapp: 29501: Stale snapshot for com.google.android.libraries.consentverifier#com.google.android.tts(change count changed - expected 17  but was 16)
        at baqs.b(:com.google.android.gms@[email protected] (040400-441847897):14)
        at baqq.g(:com.google.android.gms@[email protected] (040400-441847897):0)
        at baqn.e(:com.google.android.gms@[email protected] (040400-441847897):4)
        at baqn.f(:com.google.android.gms@[email protected] (040400-441847897):2)
        at agzc.en(:com.google.android.gms@[email protected] (040400-441847897):1)
        at agzi.run(:com.google.android.gms@[email protected] (040400-441847897):11)
        at cdcj.run(:com.google.android.gms@[email protected] (040400-441847897):2)
        at xyb.c(:com.google.android.gms@[email protected] (040400-441847897):6)
        at xyb.run(:com.google.android.gms@[email protected] (040400-441847897):7)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at ydg.run(:com.google.android.gms@[email protected] (040400-441847897):0)
        at java.lang.Thread.run(Thread.java:764)

Expected behavior

able to see login screen, proceed to login, take user input on button clicks after login.

Search result titles not visible in search results view

Search titles are not visible in adapter on Pixel 6 running Android 14

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • Offline Search SDK (OfflineSearchEngine class, and etc.)
    • Address Autofill SDK
    • Search UI SDK
  • Android OS version: 14
  • Devices affected: Pixel 6
  • Search SDK Version:
    'com.mapbox.search:offline:1.0.0-rc.6'
    'com.mapbox.search:mapbox-search-android-ui:1.0.0-rc.6'

App theme: Theme.MaterialComponents.Light.NoActio
Screenshot_20240228-180805 1
nBar

Works fine on OnePlus device with Android 13

Reverse geocoding: first and second fields will have no separator between them even if the first field is not HOUSE_NUMBER

Environment

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • Offline Search SDK (OfflineSearchEngine class, and etc.)
    • Address Autofill SDK
    • Search UI SDK
  • Android OS version: All
  • Devices affected: All
  • Search SDK Version: 1.0.0-beta.39
  • Included in project Maps SDK, Nav SDK versions if available: Maps 10.9.1

Code examples

val callback = object : SearchCallback {
        override fun onResults(results: List<SearchResult>, responseInfo: ResponseInfo) {
            val result = results.firstOrNull() ?: return
            val address = result.address ?: return
            val formatted = address.formattedAddress(SearchAddress.FormatStyle.Long) ?: return
            continuation.resume(formatted)
        }
        override fun onError(e: Exception) {
            Timber.tag("MapboxUtil").e(e)
        }
    }
    search(ReverseGeoOptions(coordinates.asPoint, limit = 1), Executors.newSingleThreadExecutor() , callback)

Observed behavior and steps

Geocoding [84.0375137, 28.1715234] and formatting the address with FormatStyle.Long results to:
Lekhnath Kaski District, Gandaki, Nepal

Expected behavior

When it should be:
Lekhnath, Kaski District, Gandaki, Nepal

It is because on fun formattedAddress(style: FormatStyle = FormatStyle.Medium): String?, it omits the separator when the first component on the FormatStyle is HOUSE_NUMBER, but it does not check if the first non-null field is actually HOUSE_NUMBER.

My workaround is to create a custom FormatStyle without HOUSE_NUMBER

House/street address format based on country specific

New Feature

Add regional/country specific house number / street number format. It's reflected on public API / playground, but not in SDK.

image

As you can see, there are 3 different types how address is formatted.

Most part of EU: Street HouseNumber, City (without any divider, only space)
Other parts oz world (expect Russia): HouseNumber Street, City
Russia: City, Street HouseNumber

/**
 * Format House number and Street name to the most used European format (not all EU countries).
 * https://qph.cf2.quoracdn.net/main-qimg-fed2c12535f9552efa214450c4c87881
 */
val SearchAddress.streetWithHouseNumber: String
    get() = "${street.orEmpty()} ${houseNumber.orEmpty()}".trim()

Why

Because not all of us live in USA. Because search suggestions should reflect local conventions.

Build fails due to duplicate class in two different MapBox modules

Environment

  • Android OS version: 13 (any)
  • Devices affected: All
  • Search SDK Version: 1.0.0-beta.37
  • Included in project Maps SDK, Nav SDK versions if available: com.mapbox.maps:android:10.8.1

Code examples

No code necessary, just adding both dependencies:

implementation "com.mapbox.maps:android:10.8.0"
implementation "com.mapbox.search:mapbox-search-android:1.0.0-beta.37"

Observed behavior and steps

When adding both the above dependencies and try to compile the app, the build fails with this error:

Duplicate class com.mapbox.common.MapboxCommonLogger found in modules base-10.8.1-runtime (com.mapbox.maps:base:10.8.1) and common-23.1.0-beta.1-runtime (com.mapbox.common:common:23.1.0-beta.1)

Expected behavior

The build should succeed.

RuntimeException android 12

Environment

  • Android OS version: Android 12
  • Devices affected: Samsung s20 FE
  • Search SDK Version: 1.0.0-beta.30
  • Mapbox Version: 10.5.0
  • Included in project Maps SDK, Nav SDK versions if available:

Code examples

MapboxSearchSdk.initialize(this, getKey())

Observed behavior and steps

2022-06-06 17:44:31.092 13808-13808/app.test E/AndroidRuntime: FATAL EXCEPTION: main Process: app.test:mapobject, PID: 13808 java.lang.UnsatisfiedLinkError: No implementation found for void com.mapbox.common.EventsService.initialize(com.mapbox.common.EventsServiceOptions) (tried Java_com_mapbox_common_EventsService_initialize and Java_com_mapbox_common_EventsService_initialize__Lcom_mapbox_common_EventsServiceOptions_2) at com.mapbox.common.EventsService.initialize(Native Method) at com.mapbox.common.EventsService.<init>(EventsService.java:15) at com.mapbox.search.analytics.SearchEventsService.<init>(SearchEventsService.kt:18) at com.mapbox.search.MapboxSearchSdk.initializeInternal$mapbox_search_android_release(MapboxSearchSdk.kt:214) at com.mapbox.search.MapboxSearchSdk.initializeInternal$mapbox_search_android_release$default(MapboxSearchSdk.kt:155) at com.mapbox.search.MapboxSearchSdk.initialize(MapboxSearchSdk.kt:142) at com.mapbox.search.MapboxSearchSdk.initialize$default(MapboxSearchSdk.kt:133) at app.AppContext.onCreate(AppContext.kt:127) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6725) at android.app.ActivityThread.access$1500(ActivityThread.java:247) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7839) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Expected behavior

When using the search sdk and maps together on the latest versions, the application crashes
If you disable the initialization of the search sdk, then everything is ok
Normal operation of the application is expected

Failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable

Environment

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • Offline Search SDK (OfflineSearchEngine class, and etc.)
    • Address Autofill SDK
    • Search UI SDK
  • Android OS version: Doesn't matter
  • Devices affected: Doesn't matter
  • Search SDK Version: "com.mapbox.search:mapbox-search-android:1.0.0-beta.41"
  • Included in project Maps SDK, Nav SDK versions if available:
    "com.mapbox.maps:android:10.9.1"

Code examples

    implementation "com.mapbox.maps:android:10.9.1"
    implementation "com.mapbox.search:mapbox-search-android:1.0.0-beta.41"

Observed behavior and steps

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkLocalMockDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.mapbox.android.core.location.LocationEngine found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)
     Duplicate class com.mapbox.android.core.location.LocationEngineCallback found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)
     Duplicate class com.mapbox.android.core.location.LocationEngineProvider found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)
     Duplicate class com.mapbox.android.core.location.LocationEngineRequest found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)
     Duplicate class com.mapbox.android.core.location.LocationEngineRequest$Builder found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)
     Duplicate class com.mapbox.android.core.location.LocationEngineResult found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)
     Duplicate class com.mapbox.android.core.permissions.PermissionsListener found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)
     Duplicate class com.mapbox.android.core.permissions.PermissionsManager found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)
     Duplicate class com.mapbox.android.core.permissions.PermissionsManager$AccuracyAuthorization found in modules common-23.2.0-rc.3-runtime (com.mapbox.common:common:23.2.0-rc.3) and mapbox-android-core-5.0.2-runtime (com.mapbox.mapboxsdk:mapbox-android-core:5.0.2)

Expected behavior

To build the project without an issue.

PR #172 merged without successful status checks (mapbox-search-android)

👋 Hey there! It's Changebot, and I help repositories follow our engineering best practices. My magic wand found some things I wanted to highlight for your review:

Item Current status Required? Best practice guidelines
Run unsuccessful: ci/circleci: instrumentation-tests failure required success
Run unsuccessful: publisher-deployer neutral optional success

The following PR was merged without the status checks passing: #172

Can you take a look at these best practices and make any adjustments if needed?

Please tag @mapbox/security-and-compliance on this issue if you have any questions

Failed to build when using 11.0.0 and MapBox Search 1.0.0-rc7

Environment

  • Android OS version:
  • Devices affected: -
  • Maps SDK Version: 11.0.0
  • MapBox Search Version: 1.0.0-rc7

Observed behavior and steps to reproduce

I am importing both libraries:

    implementation("com.mapbox.maps:android:11.0.0")
    implementation("com.mapbox.search:mapbox-search-android:1.0.0-rc.7")

And I get the following error:

  • What went wrong:
    Execution failed for task ':app:checkRemoteProdDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class com.mapbox.common.module.okhttp.CallbackWrapper found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.CallbackWrapper$RequestCallback found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.HttpCallback found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.IdGenerator found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.LazyClient found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService$1 found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.MapboxOkHttpService$HttpServiceOfflineSwitchObserver found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.NetworkUsageListener found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.NetworkUsageListener$1 found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.NetworkUsageListener$DummyEventListener found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.common.module.okhttp.NetworkUsageListener$NetworkUsageMetricCallback found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)
Duplicate class com.mapbox.module.Mapbox_HttpClientModuleConfiguration found in modules common-24.0.0-runtime (com.mapbox.common:common:24.0.0) and okhttp-23.6.0-runtime (com.mapbox.common:okhttp:23.6.0)

When commenting out the search library it builds successfully with no error.

Expected behavior

I would expect it to build with no issues.

Notes / preliminary analysis

Additional links and references

AddressAutofill suggestions is not working

Integrated following Mapbox dependencies

implementation 'com.mapbox.maps:android:10.15.1'
implementation "com.mapbox.search:place-autocomplete:1.0.0-rc.7"
implementation "com.mapbox.search:autofill:1.0.0-rc.7"

And initialized AddressAutofill with
addressAutofill = AddressAutofill.create(getString(R.string.mapbox_access_token))

But while using suggestions() to get address list, getting

Cannot access class 'com.mapbox.search.common.IsoLanguageCode'. Check your module classpath for missing or conflicting dependencies`

val addresses = addressAutofill.suggestions(searchQuery!!, AddressAutofillOptions())

Is there any work around this ? or do I need to use the API feature ?

SearchBox returns incorrect Data

Hi Mapbox team, first of all, thank you for great Library. It's very helpful to us.
I know this is not related to your Repo, but I could not find the repo or any resources that I can use to report to MapBox team. I posted this with the hope that you can help me reach to them and let them know about this issue. Thank you so much.

Issue

The data (locality in context) returns incorrect data
API: https://docs.mapbox.com/playground/search-box/?q=Comedy+Cellar&language=en&country=us&session_token=0eb14ef0-969a-46c1-88d1-b9451650e314

Description

We're using this API and before that it returned the data correctly, but now it doesn't. It should return Manhattan instead of meaningless character d in locality.

Screenshot 2024-01-18 at 15 00 48

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.