mapbox / mapbox-navigation-android

Mapbox Navigation SDK for Android
https://docs.mapbox.com/android/navigation/overview/
Other
622 stars 319 forks source link

java.lang.IllegalArgumentException: Non-null and non-empty location list required. #3131

Closed vidhi1011 closed 4 years ago

vidhi1011 commented 4 years ago

@Guardiola31337 getting this crash in new latest versions I am using navigation view 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6'

Process: com.flashmarket.delivery, PID: 2437
    java.lang.IllegalArgumentException: Non-null and non-empty location list required.
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayLocationDispatcher.checkValidInput(ReplayLocationDispatcher.java:79)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayLocationDispatcher.<init>(ReplayLocationDispatcher.java:22)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.obtainDispatcher(ReplayRouteLocationEngine.java:164)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.start(ReplayRouteLocationEngine.java:154)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.beginReplayWith(ReplayRouteLocationEngine.java:203)
        at com.mapbox.services.android.navigation.v5.location.replay.ReplayRouteLocationEngine.requestLocationUpdates(ReplayRouteLocationEngine.java:113)
        at com.mapbox.services.android.navigation.v5.navigation.LocationUpdater.requestInitialLocationUpdates(LocationUpdater.java:58)
        at com.mapbox.services.android.navigation.v5.navigation.LocationUpdater.<init>(LocationUpdater.java:31)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.initializeLocationUpdater(NavigationService.java:124)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.initialize(NavigationService.java:95)
        at com.mapbox.services.android.navigation.v5.navigation.NavigationService.startNavigation(NavigationService.java:66)
        at com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation.onServiceConnected(MapboxNavigation.java:813)
        at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2037)
        at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2069)
        at android.os.Handler.handleCallback(Handler.java:888)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:213)
        at android.app.ActivityThread.main(ActivityThread.java:8178)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
Guardiola31337 commented 4 years ago

Hey 👋 @vidhi1011 thanks for checking out the SDK

As mentioned in https://github.com/mapbox/mapbox-navigation-android/issues/2019 ReplayRouteLocationEngine is going to be deprecated and replaced by ReplayLocationEngine 👀 https://github.com/mapbox/mapbox-navigation-android/pull/300 in 1.0 and first public beta release release_core_1.0.0-rc.1 was released 🎉 🚀

Please review the developer documentation to start building with the Mapbox core Navigation SDK v1.0 for Android and if you already use an older version of the Navigation SDK, check out the migration guide to transition your project from the "legacy" core Navigation SDK to the 1.0 version and let us know if you have any questions or run into issues and please open tickets in https://github.com/mapbox/mapbox-navigation-android/issues/new and we will take it from there! We would love your feedback.

Thanks again!

cc @kmadsen

vidhi1011 commented 4 years ago

Hi @Guardiola31337 @kmadsen Thanks for looking into my issue. Could you please help me with dependencies. I am not able to resolve dependencies

I have tried :

implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:1.0.0'

implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:1.0.0-rc.1'

implementation 'com.mapbox.navigation:core:1.0.0-rc.1'

but both not working for me.

In project level gradle i have :

allprojects {
    repositories {
        google()
        maven { url 'https://mapbox.bintray.com/mapbox' }
        jcenter()

    }
}
Guardiola31337 commented 4 years ago

Hey @vidhi1011 👋

As mentioned, we released release_core_1.0.0-rc.1 🎉 🚀

Please review the developer documentation to start building with the Mapbox core Navigation SDK v1.0 for Android. After adding that setup you should be able to build from source.

For the UI dependency that will be solved when releasing 1.0 publicly. For now, only Core SDK is available but stay tuned!

Let us know if you run into any issues or if you find something missing in the documentation. Thanks for understanding!

vidhi1011 commented 4 years ago

image

@Guardiola31337 Core sdk Not working

Guardiola31337 commented 4 years ago

cc @abhishek1508

abhishek1508 commented 4 years ago

@vidhi1011 Can you share your project level build gradle here for us to be able to look at it. Thanks

vidhi1011 commented 4 years ago

Hi @abhishek1508 @Guardiola31337 Here is my project level gradle :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.41'
    ext.dagger2_version = '2.17'
    ext.retrofit_version = '2.4.0'

    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "com.google.gms:google-services:4.2.0"

        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

        maven {
            url 'https://api.mapbox.com/downloads/v1/navigation/android/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username = "my-username"
                password = "my-token"
            }
        }
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Screenshot from 2020-06-11 09-53-35

abhishek1508 commented 4 years ago

Hi @vidhi1011

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

        maven {
            url 'https://api.mapbox.com/downloads/v1/navigation/android/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username = "my-username"
                password = "my-token"
            }
        }
        jcenter()

    }
}

In this section, can you replace username = "my-username" with username = "mapbox". It should work.

This should be final project and app level build gradle

project/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://api.mapbox.com/downloads/v1/navigation/android/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username = project.properties['MAPBOX_USER'] ?: ""
                password = project.properties['MAPBOX_TOKEN'] ?: ""
            }
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"

    defaultConfig {
        applicationId "com.example.example"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 2
        versionName "0.0.2"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    buildFeatures {
        dataBinding = true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    // Mapbox
    implementation 'com.mapbox.navigation:core:1.0.0-rc.1'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

where MAPBOX_USER=mapbox and MAPBOX_TOKEN=sk.something,i.created

vidhi1011 commented 4 years ago

image image image

Nothing is there in this dependency :( :( :(

image

@abhishek1508 Library worked but nothing else working in project :( :(

Is there any dates by which we will get new navigation view dependency v1 ?

Guardiola31337 commented 4 years ago

@vidhi1011

Library worked but nothing else working in project :( :(

Core SDK doesn't include Maps dependency transitively but you can always integrate it directly https://docs.mapbox.com/android/maps/overview/ Also worth mentioning that you won't need to do that when the 1.0 compatible UI SDK is out. We're working hard to get it released 🔜 Stay tuned!

Thanks again for checking out the SDK 🙇