I am in the process of creating an Android navigation application using the Mapbox SDK (version 9.5.0 currently) and I have successfully been able to initialize a map view as well as track the user's current location. Up until this point I have had no issues with unresolved import statements or any real problems. The feature I am currently working on is to allow the user to select a location point on the map, which will place a map marker on that point and return the coordinates of the marker. To incorporate this feature I have been following the Mapbox Documentation, specifically this tutorial.
Now that I have added this new code to my application I have found a few issues, there are quite a number of objects that I am trying to make use of that can not be resolved, to look into this issue I went to my import statements at the top of my java file and found a few imports that are not working properly, namely:
import com.mapbox.api.geocoding.v5.GeocodingCriteria;
import com.mapbox.api.geocoding.v5.MapboxGeocoding;
import com.mapbox.api.geocoding.v5.models.CarmenFeature;
import com.mapbox.api.geocoding.v5.models.GeocodingResponse;
The above imports all have a red line under "api" and give the error: " Cannot resolve symbol 'api' " . Some other erroneous imports are:
import com.mapbox.core.exceptions.ServicesException;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import timber.log.Timber;
I am not sure why all of these specific imports are unresolved, as all of my other Mapbox imports haven't given me any issues yet. I suspect it might be a missing dependency or implementation in my Gradle files, but I have followed the documentation guide to be best of my ability so unless I missed something vital I am not sure what the cause might be. Here are the Mapbox dependencies and implementations that I added to my grade files: Project-level build.gradle:
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
username = 'mapbox'
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: "my secret password"
}
}
and in my app-level build.gradle:
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.5.0'
If anyone has an idea of what my issue could be, I would greatly appreciate any help.