Arcgis runtime for Android 问题解决:Could not resolve,Received status code 403 from server: Forbidden

最近新建项目引用arcgis runtime for Android 时,按照官网步骤一步步来,结果发现引入不了,项目下的build.gradle中也添加了仓库

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

构建项目报错:

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.esri.arcgisruntime:arcgis-android:100.8.0.
Show Details
Affected Modules: app

运行时报错:

Could not HEAD 'https://esri.bintray.com/arcgis/com/esri/arcgisruntime/arcgis-android/100.8.0/arcgis-android-100.8.0.pom'. Received status code 403 from server: Forbidden
Disable Gradle 'offline mode' and sync project

提示网站拒绝了请求,

解决方案:

将项目下的build.gradle

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

替换为:

allprojects {
    repositories {
    ...
    maven { url 'https://esri.jfrog.io/artifactory/arcgis' }
    ...
    }
}

之后重新构建,就可以引入成功了。

扩展:

在解决这个问题的时候,顺便把其他仓库都替换成了阿里云镜像仓库,构建时间大大减少。

repositories {
        maven { url 'https://maven.aliyun.com/repository/public' }//jcenter
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }//gradle-plugin
        maven { url 'https://maven.aliyun.com/repository/central' }//central
        maven { url 'https://maven.aliyun.com/repository/google' }//google
        google()
        jcenter()
    }
···
allprojects {
    repositories {
        maven { url 'https://maven.aliyun.com/repository/public' }//jcenter
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }//gradle-plugin
        maven { url 'https://maven.aliyun.com/repository/central' }//central
        maven { url 'https://maven.aliyun.com/repository/google' }//google
        maven { url 'https://esri.jfrog.io/artifactory/arcgis' }
        maven { url 'https://jitpack.io' }
        google()
        jcenter()
        flatDir{
            dirs 'libs'//A依赖B,B依赖C,要想A能访问C的libs,就得添加这个
        }
    }
}

你可能感兴趣的:(Arcgis runtime for Android 问题解决:Could not resolve,Received status code 403 from server: Forbidden)