Cannot resolve symbol "CarmenFeature"

Iann7 :

I'm trying to use a fragment autocomplete UI from ---> https://docs.mapbox.com/android/plugins/overview/places/

but the IDE says that it can't resolve the symbol CarmenFeature and I don't know how to import that class or solve this exception

I've tried :

  • to import ---> import com.mapbox.api.v4.models.CarmenFeature; but I think that the API folder does not exist

  • sync with gradle

  • invalidate cache and restart

  • rebuild project

  • clean project


autocompleteFragment = (SupportPlaceAutocompleteFragment) getSupportFragmentManager().findFragmentByTag(TAG);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
   @Override
   public void onPlaceSelected( CarmenFeature carmenFeature) {

   }

   @Override
   public void onError(Status status) {

   }
});
Jorgesys :

Well the problem is that the class cannot be imported and loaded. You need to configure inside the build.gradle in the root of your project :

allprojects {
    repositories {
        ...
        ...
        maven
             {
              url 'https://mapbox.bintray.com/mapbox'
             }
    }
}

and inside your /app/build.gradle :

dependencies {
    ...
    ...  
    // MAPBOX DEPENDENCIES
    implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:6.5.0@aar')
            {
                transitive=true
            }
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.20.0'
    implementation ('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.20.0')
            {
                transitive = true
            }
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.android.support:design:27.0.2'

}

this is enough to use the CarmenFeature class.

enter image description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=154341&siteId=1