mapbox / mapbox-navigation-android

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

Received status code 403 from server: Request blocked by Privoxy #5284

Open Yokesh1593 opened 2 years ago

Yokesh1593 commented 2 years ago

Hi team,

My gradle build is failing to sync with the following dependencies:

build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter { url "http://jcenter.bintray.com/" }
        maven { url "http://jitpack.io/" }
        maven { url "https://maven.google.com" }
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://mapbox.bintray.com/mapbox' }
        flatDir {
            dirs '/libs'
        }
        maven {
            url 'https://api.mapbox.com/downloads/v2/releases/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                // Do not change the username below.
                // This should always be `mapbox` (not your username).
                username = "mapbox"
                // Use the secret token you stored in gradle.properties as the password
                password = "MAPBOX_DOWNLOADS_TOKEN"
            }
        }
    }
}

dependencies

 implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:8.2.1') {
        transitive = true
    }
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.40.0'
    implementation ('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.40.0') {
        transitive = true
    }

Error

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.mapbox.navigator:mapbox-navigation-native:6.2.1.
  Required by:
      project :app > com.mapbox.mapboxsdk:mapbox-android-navigation:0.40.0
   > Skipped due to earlier error
   > Could not resolve com.mapbox.navigator:mapbox-navigation-native:6.2.1.
      > Could not get resource 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigator/mapbox-navigation-native/6.2.1/mapbox-navigation-native-6.2.1.pom'.
         > Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigator/mapbox-navigation-native/6.2.1/mapbox-navigation-native-6.2.1.pom'. Received status code 403 from server: Request blocked by Privoxy

even placed the secret key in gradle.properties but could find how to resolve this issue. kindly help us to resolve

Zayankovsky commented 2 years ago

@JeenYokesh please remove maven { url 'https://mapbox.bintray.com/mapbox' } from the list of repositories and update com.mapbox.mapboxsdk:mapbox-android-navigation and com.mapbox.mapboxsdk:mapbox-android-navigation-ui dependencies to version 0.42.6. Also it should be noted that v0.x series of the Navigation SDK is not supported anymore, so please don't hesitate to check out the supported v2 version of the Navigation SDK.

Yokesh1593 commented 2 years ago

@Zayankovsky Thanks for your response on the issue.

After removing the maven { url 'https://mapbox.bintray.com/mapbox' } from the list of repositories and updated dependencies to v2 version as below

implementation ('com.mapbox.maps:android:10.2.0'){
        exclude group: 'group_name', module: 'module_name'
    }
 implementation "com.mapbox.navigation:android:2.1.1"
 implementation 'com.mapbox.navigation:ui:2.1.1'

I get the below issues

Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/maps/android/10.2.0/android-10.2.0.pom'. Received status code 403 from server: Request blocked by Privoxy
Disable Gradle 'offline mode' and sync project

​Then I disabled the office mode too, then rebuild the project I got the following issue.

No cached version of com.mapbox.maps:android:10.2.0 available for offline mode.
Disable Gradle 'offline mode' and sync project
Zayankovsky commented 2 years ago

@JeenYokesh my suggestion was to update dependencies to version 0.42.6. If you are ready to use version 2.1.1 then you should follow the installation guide here: https://docs.mapbox.com/android/navigation/guides/get-started/install/. For instance there is no such dependency as com.mapbox.navigation:ui:2.1.1, it has to be removed. Also make sure your secret token has the Downloads:Read permission and is correctly used when configuring repositories. If you're still having problems then I will have to take a look at your updated project setup to help you further.

Yokesh1593 commented 2 years ago

@JeenYokesh my suggestion was to update dependencies to version 0.42.6. If you are ready to use version 2.1.1 then you should follow the installation guide here: https://docs.mapbox.com/android/navigation/guides/get-started/install/. For instance there is no such dependency as com.mapbox.navigation:ui:2.1.1, it has to be removed. Also make sure your secret token has the Downloads:Read permission and is correctly used when configuring repositories. If you're still having problems then I will have to take a look at your updated project setup to help you further.

Hi @Zayankovsky I need to migrate to my existing app, where i am using Android Studio Arctic Fox | 2020.3.1 Patch 4. Kindly check below setup which i followed as docs mentioned with secretKey in gradle.properties.

build.gradle (Project)

buildscript {
    ext.kotlin_version = '1.3.40'
    repositories {
        google()
        jcenter()
        mavenCentral()
        gradlePluginPortal()
        maven {
            url "https://jitpack.io/"
        }
        // Add repository
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:3.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url "http://jitpack.io/" }
        maven { url "https://maven.google.com" }
        // Add repository
//        maven { url 'https://mapbox.bintray.com/mapbox' }
        flatDir {
            dirs '/libs'
        }
        maven {
            url 'https://api.mapbox.com/downloads/v2/releases/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                // Do not change the username below.
                // This should always be `mapbox` (not your username).
                username = "mapbox"
                // Use the secret token you stored in gradle.properties as the password
                password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
            }
        }
    }
}

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

build.gradle (app)

dependencies {
    implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:8.5.1'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.42.6'
    implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6'
}
Could not GET 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/navigator/mapbox-navigation-native/7.0.0/mapbox-navigation-native-7.0.0.pom'. Received status code 403 from server: Request blocked by Privoxy
Disable Gradle 'offline mode' and sync project
Zayankovsky commented 2 years ago

@JeenYokesh your setup looks good to me. Since the error mentions Privoxy, I would suggest to try building with Privoxy disabled.

ShivaniChandel commented 2 years ago

Hi team,

My gradle build is failing to sync with the following dependencies:

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

}

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

}

allprojects { repositories { google() mavenCentral() maven { url 'https://api.mapbox.com/downloads/v2/releases/maven' authentication { basic(BasicAuthentication) } credentials { // Do not change the username below. // This should always be mapbox (not your username). username = "mapbox" // Use the secret token you stored in gradle.properties as the password password = MAPBOX_DOWNLOADS_TOKEN } } }

}

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

dependencies

implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:8.5.1' implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation:0.42.6' implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.6'

Gradle Properties

systemProp.MAPBOX_DOWNLOADS_TOKEN="my_token"

Error Msg

FAILURE: Build completed with 7 failures.

1: Task failed with an exception.

2: Task failed with an exception.

3: Task failed with an exception.

4: Task failed with an exception.

5: Task failed with an exception.

6: Task failed with an exception.

7: Task failed with an exception.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 10s 18 actionable tasks: 8 executed, 10 up-to-date

Need Help plz comment

Zayankovsky commented 2 years ago

@ShivaniChandel you need to add JitPack repository this way:

allprojects {
    repositories {
        google()
        mavenCentral()
        maven {
            url 'https://api.mapbox.com/downloads/v2/releases/maven'
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                // Do not change the username below.
                // This should always be mapbox (not your username).
                username = "mapbox"
                // Use the secret token you stored in gradle.properties as the password
                password = MAPBOX_DOWNLOADS_TOKEN
            }
        }
        maven { url 'https://jitpack.io' }
    }
}

Please note that this issue is caused by incorrectly integrating other libraries, not Navigation SDK.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.