Closed Krageek closed 6 years ago
@Krageek i also face this issue you can also use custom navigation activity like `@Override public void onNavigationReady() { NavigationViewOptions options = NavigationViewOptions.builder() .origin(origin) .destination(destination) .awsPoolId(awsPoolId) .shouldSimulateRoute(simulateRoute) .build();
navigationView.startNavigation(options); }`
your error will be resolved
@Meerz Could you tell me where in the code do i add this?
Hey @Krageek, I'm seeing in your code that you're using NavigationView
as well as NavigationLauncher
- only one or the other should be used and I would also advise against using NavigationView
in the same XML as a normal MapView
. This is because NavigationView
wraps a MapView
and may cause conflicts with your normal MapView
implementation.
In the future, please direct these types of questions to https://stackoverflow.com/questions/tagged/mapbox. This will help other developers see your issue and provide help. We (at Mapbox) are also checking these questions and will provide help there regarding your implementation. Thanks!
Hey !! i too got the error
11-17 19:20:15.441 30900-30900/com.makani E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.makani, PID: 30900
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.makani/com.mapbox.services.android.navigation.ui.v5.MapboxNavigationActivity}: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class com.mapbox.services.android.navigation.ui.v5.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class com.mapbox.services.android.navigation.ui.v5.NavigationView
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.mapbox.services.android.navigation.ui.v5.MapboxNavigationActivity.onCreate(MapboxNavigationActivity.java:31)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.mapbox.services.android.navigation.ui.v5.NavigationView
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.mapbox.services.android.navigation.ui.v5.MapboxNavigationActivity.onCreate(MapboxNavigationActivity.java:31)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:619)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.mapbox.services.android.navigation.ui.v5.MapboxNavigationActivity.onCreate(MapboxNavigationActivity.java:31)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.view.InflateException: Binary XML file line #25: Binary XML file line #25: Error inflating class com.mapbox.services.android.navigation.ui.v5.RecenterButton
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.view.View.inflate(View.java:19790)
at com.mapbox.services.android.navigation.ui.v5.NavigationView.initializeView(NavigationView.java:485)
at com.mapbox.services.android.navigation.ui.v5.NavigationView.
while running the below code
NavigationLauncherOptions.Builder optionsBuilder = NavigationLauncherOptions.builder() .shouldSimulateRoute(false) .directionsProfile("driving-traffic"); optionsBuilder.directionsRoute(route); NavigationLauncher.startNavigation(this, optionsBuilder.build());
please help!!
i have same problem too `private void launchNavigationWithRoute() { if (route == null) { Snackbar.make(mapView, R.string.error_route_not_available, Snackbar.LENGTH_SHORT).show(); return; }
NavigationLauncherOptions.Builder optionsBuilder = NavigationLauncherOptions.builder()
.shouldSimulateRoute(getShouldSimulateRouteFromSharedPreferences())
.directionsProfile(getRouteProfileFromSharedPreferences());
optionsBuilder.directionsRoute(route);
NavigationLauncher.startNavigation(this, optionsBuilder.build());
}
in this function that implement from your sample repository and full code below
package app.activities;
import android.content.Intent; import android.content.SharedPreferences; import android.location.Location; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.FrameLayout; import android.widget.ProgressBar; import android.widget.Toast;
import com.mapbox.android.core.location.LocationEngine; import com.mapbox.android.core.location.LocationEngineListener; import com.mapbox.android.core.location.LocationEngineProvider; import com.mapbox.api.directions.v5.DirectionsCriteria; import com.mapbox.api.directions.v5.models.DirectionsResponse; import com.mapbox.api.directions.v5.models.DirectionsRoute; import com.mapbox.core.constants.Constants; import com.mapbox.geojson.LineString; import com.mapbox.geojson.Point; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.exceptions.InvalidLatLngBoundsException; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.location.LocationComponent; import com.mapbox.mapboxsdk.location.modes.RenderMode; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.services.android.navigation.ui.v5.NavigationLauncher; import com.mapbox.services.android.navigation.ui.v5.NavigationLauncherOptions; import com.mapbox.services.android.navigation.ui.v5.route.NavigationMapRoute; import com.mapbox.services.android.navigation.ui.v5.route.OnRouteSelectionChangeListener; import com.mapbox.services.android.navigation.v5.navigation.NavigationRoute; import com.mapbox.services.android.navigation.v5.utils.LocaleUtils;
import java.util.ArrayList; import java.util.List; import java.util.Locale;
import app.ir.kiantechno.bet.R; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import retrofit2.Call; import retrofit2.Response;
import static com.mapbox.android.core.location.LocationEnginePriority.HIGH_ACCURACY;
public class WorkBookActivity extends AppCompatActivity implements OnMapReadyCallback, MapboxMap.OnMapLongClickListener, LocationEngineListener, OnRouteSelectionChangeListener {
private static final int CAMERA_ANIMATION_DURATION = 1000; private static final int DEFAULT_CAMERA_ZOOM = 16; private static final int CHANGE_SETTING_REQUEST_CODE = 1; private static final int INITIAL_ZOOM = 16;
private LocationEngine locationEngine; private NavigationMapRoute mapRoute; private MapboxMap mapboxMap; private Marker currentMarker; private Point currentLocation; private Point destination; private DirectionsRoute route; private LocaleUtils localeUtils; private boolean locationFound;
@BindView(R.id.mapView) MapView mapView; @BindView(R.id.launch_route_btn) Button launchRouteBtn; @BindView(R.id.loading) ProgressBar loading; @BindView(R.id.launch_btn_frame) FrameLayout launchBtnFrame;
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.mapbox_access_token)); setContentView(R.layout.activity_work_book); ButterKnife.bind(this); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); localeUtils = new LocaleUtils(); }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.navigation_view_activity_menu, menu); return true; }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settings: showSettings(); return true; default: return super.onOptionsItemSelected(item); } }
private void showSettings() { startActivityForResult(new Intent(this, NavigationSettingsActivity.class), CHANGE_SETTING_REQUEST_CODE); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == CHANGE_SETTING_REQUEST_CODE && resultCode == RESULT_OK) { boolean shouldRefetch = data.getBooleanExtra(NavigationSettingsActivity.UNIT_TYPE_CHANGED, false) || data.getBooleanExtra(NavigationSettingsActivity.LANGUAGE_CHANGED, false); if (destination != null && shouldRefetch) { fetchRoute(); } } }
@Override protected void onStart() { super.onStart(); mapView.onStart(); }
@SuppressWarnings( {"MissingPermission"}) @Override public void onResume() { super.onResume(); mapView.onResume(); if (locationEngine != null) { locationEngine.addLocationEngineListener(this); if (!locationEngine.isConnected()) { locationEngine.activate(); } } }
@Override public void onPause() { super.onPause(); mapView.onPause(); if (locationEngine != null) { locationEngine.removeLocationEngineListener(this); } }
@Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); }
@Override protected void onStop() { super.onStop(); mapView.onStop(); }
@Override protected void onDestroy() { super.onDestroy(); mapView.onDestroy(); if (locationEngine != null) { locationEngine.removeLocationUpdates(); locationEngine.deactivate(); } }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); }
@OnClick(R.id.launch_route_btn) public void onRouteLaunchClick() { launchNavigationWithRoute(); }
@Override public void onMapReady(MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; this.mapboxMap.addOnMapLongClickListener(this); initLocationEngine(); initializeLocationComponent(); initMapRoute(); }
@Override public void onMapLongClick(@NonNull LatLng point) { destination = Point.fromLngLat(point.getLongitude(), point.getLatitude()); launchRouteBtn.setEnabled(false); loading.setVisibility(View.VISIBLE); setCurrentMarkerPosition(point); if (currentLocation != null) { fetchRoute(); } }
@SuppressWarnings( {"MissingPermission"}) @Override public void onConnected() { locationEngine.requestLocationUpdates(); }
@Override public void onLocationChanged(Location location) { currentLocation = Point.fromLngLat(location.getLongitude(), location.getLatitude()); onLocationFound(location); }
@Override public void onNewPrimaryRouteSelected(DirectionsRoute directionsRoute) { route = directionsRoute; }
@SuppressWarnings( {"MissingPermission"}) private void initLocationEngine() { locationEngine = new LocationEngineProvider(this).obtainBestLocationEngineAvailable(); locationEngine.setPriority(HIGH_ACCURACY); locationEngine.setInterval(0); locationEngine.setFastestInterval(1000); locationEngine.addLocationEngineListener(this); locationEngine.activate();
if (locationEngine.getLastLocation() != null) {
Location lastLocation = locationEngine.getLastLocation();
onLocationChanged(lastLocation);
currentLocation = Point.fromLngLat(lastLocation.getLongitude(), lastLocation.getLatitude());
}
}
@SuppressWarnings( {"MissingPermission"}) private void initializeLocationComponent() { LocationComponent locationComponent = mapboxMap.getLocationComponent(); locationComponent.activateLocationComponent(this, locationEngine); locationComponent.setLocationComponentEnabled(true); locationComponent.setRenderMode(RenderMode.COMPASS); }
private void initMapRoute() { mapRoute = new NavigationMapRoute(mapView, mapboxMap); mapRoute.setOnRouteSelectionChangeListener(this); }
private void fetchRoute() {
NavigationRoute.Builder builder = NavigationRoute.builder(this)
.accessToken(Mapbox.getAccessToken())
.origin(currentLocation)
.destination(destination)
.alternatives(true);
setFieldsFromSharedPreferences(builder);
builder.build()
.getRoute(new SimplifiedCallback() {
@Override
public void onResponse(Call
private void setFieldsFromSharedPreferences(NavigationRoute.Builder builder) { builder .language(getLanguageFromSharedPreferences()) .voiceUnits(getUnitTypeFromSharedPreferences()); }
private String getUnitTypeFromSharedPreferences() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); String defaultUnitType = getString(R.string.default_unit_type); String unitType = sharedPreferences.getString(getString(R.string.unit_type_key), defaultUnitType); if (unitType.equals(defaultUnitType)) { unitType = localeUtils.getUnitTypeForDeviceLocale(this); }
return unitType;
}
private Locale getLanguageFromSharedPreferences() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); String defaultLanguage = getString(R.string.default_locale); String language = sharedPreferences.getString(getString(R.string.language_key), defaultLanguage); if (language.equals(defaultLanguage)) { return localeUtils.inferDeviceLocale(this); } else { return new Locale(language); } }
private boolean getShouldSimulateRouteFromSharedPreferences() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); return sharedPreferences.getBoolean(getString(R.string.simulate_route_key), false); }
private String getRouteProfileFromSharedPreferences() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); return sharedPreferences.getString( getString(R.string.route_profile_key), DirectionsCriteria.PROFILE_DRIVING_TRAFFIC ); }
private void launchNavigationWithRoute() { if (route == null) { Snackbar.make(mapView, R.string.error_route_not_available, Snackbar.LENGTH_SHORT).show(); return; }
NavigationLauncherOptions.Builder optionsBuilder = NavigationLauncherOptions.builder()
.shouldSimulateRoute(getShouldSimulateRouteFromSharedPreferences())
.directionsProfile(getRouteProfileFromSharedPreferences());
optionsBuilder.directionsRoute(route);
NavigationLauncher.startNavigation(this, optionsBuilder.build());
}
private boolean validRouteResponse(Response
private void hideLoading() { if (loading.getVisibility() == View.VISIBLE) { loading.setVisibility(View.INVISIBLE); } }
private void onLocationFound(Location location) { if (!locationFound) { animateCamera(new LatLng(location.getLatitude(), location.getLongitude())); Snackbar.make(mapView, R.string.explanation_long_press_waypoint, Snackbar.LENGTH_LONG).show(); locationFound = true; hideLoading(); } }
public void boundCameraToRoute() {
if (route != null) {
List
private void animateCameraBbox(LatLngBounds bounds, int animationTime, int[] padding) { CameraPosition position = mapboxMap.getCameraForLatLngBounds(bounds, padding); mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(position), animationTime); }
private void animateCamera(LatLng point) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(point, DEFAULT_CAMERA_ZOOM), CAMERA_ANIMATION_DURATION); }
private void setCurrentMarkerPosition(LatLng position) {
if (position != null) {
if (currentMarker == null) {
MarkerViewOptions markerViewOptions = new MarkerViewOptions()
.position(position);
currentMarker = mapboxMap.addMarker(markerViewOptions);
} else {
currentMarker.setPosition(position);
}
}
}
} and my gradle below
apply plugin: 'com.android.application'
android {
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
res.srcDirs = ['src/main/res', 'src/main/res/drawable']
}
}
dexOptions {
maxProcessCount 8
javaMaxHeapSize "2g"
preDexLibraries true
}
lintOptions {
checkReleaseBuilds false
}
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
applicationId 'app.com.kiantechno.bet'
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName '1.0.0'
// testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { }
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies { annotationProcessor 'com.mindorks.android:placeholderview-compiler:1.0.3' implementation fileTree(include: ['*.jar'], dir: 'libs') //noinspection GradleCompatible implementation 'com.android.support:appcompat-v7:27.1.1' //noinspection GradleCompatible implementation 'com.android.support:design:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.0.2' //noinspection GradleCompatible implementation 'com.android.support:cardview-v7:26.0.1' implementation 'com.github.roojin:persian-calendar-view:1.2.2' implementation 'com.mcxiaoke.volley:library:1.0.19' implementation 'de.hdodenhof:circleimageview:2.+' implementation 'com.zarinpal:purchase:0.0.4-beta' implementation 'com.github.bumptech.glide:glide:3.7.0' implementation 'uk.co.chrisjenx:calligraphy:2.3.0' implementation 'com.github.markushi:circlebutton:1.1' implementation 'io.github.jeancsanchez.jcplayer:jcplayer:2.6.0-alpha' implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0' implementation 'com.mindorks.android:placeholderview:1.0.3' implementation 'com.google.code.gson:gson:2.8.0' implementation 'com.squareup.retrofit2:retrofit:2.4.0' implementation 'com.squareup.retrofit2:converter-gson:2.1.0' implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.7.1' implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.19.0' implementation "com.jakewharton:butterknife:8.8.1" implementation "com.jakewharton:butterknife-compiler:8.8.1" annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
and add maven { url 'https://mapbox.bintray.com/mapbox' } to gradle and get this error:
12-03 01:12:28.276 24297-24297/app.com.kiantechno.bet E/AndroidRuntime: FATAL EXCEPTION: main
Process: app.com.kiantechno.bet, PID: 24297
java.lang.RuntimeException: Unable to start activity ComponentInfo{app.com.kiantechno.bet/com.mapbox.services.android.navigation.ui.v5.MapboxNavigationActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class com.mapbox.services.android.navigation.ui.v5.NavigationView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2702)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class com.mapbox.services.android.navigation.ui.v5.NavigationView
at android.view.LayoutInflater.createView(LayoutInflater.java:640)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.mapbox.services.android.navigation.ui.v5.MapboxNavigationActivity.onCreate(MapboxNavigationActivity.java:31)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.mapbox.services.android.navigation.ui.v5.MapboxNavigationActivity.onCreate(MapboxNavigationActivity.java:31)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class com.mapbox.services.android.navigation.ui.v5.RecenterButton
at android.view.LayoutInflater.createView(LayoutInflater.java:640)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at android.view.View.inflate(View.java:19574)
at com.mapbox.services.android.navigation.ui.v5.NavigationView.initializeView(NavigationView.java:419)
at com.mapbox.services.android.navigation.ui.v5.NavigationView.
This is my MapBoxNavigationActivity.java file
This is my app level build.gradle file
This is the error that im getting
This is the code for the xml file