【发布时间】:2021-05-30 08:07:23
【问题描述】:
根据https://docs.mapbox.com/android/maps/guides/install/添加所有依赖项后,当我尝试运行应用程序时出现此错误:
同步错误:
无法解决:legacy-support-core-utils-1.0.0 受影响的模块: 应用
构建错误:
任务“:app:compileDebugJavaWithJavac”执行失败。
无法解析配置“:app:debugCompileClasspath”的所有文件。 找不到 legacy-support-core-utils-1.0.0.jar (androidx.legacy:legacy-support-core-utils:1.0.0)。 在以下位置搜索: https://dl.google.com/dl/android/maven2/androidx/legacy/legacy-support-core-utils/1.0.0/legacy-support-core-utils-1.0.0.jar
可能的解决方案:
- 声明提供工件的存储库,请参阅https://docs.gradle.org/current/userguide/declaring_repositories.html 上的文档
这是我的 build.gradle 模块级:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.hamimap.android"
minSdkVersion 14
targetSdkVersion 30
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled true
debuggable false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
debuggable true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.1'
}
这是我的 build.gradle 项目级:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.2"
// 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/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'] ?: 'my secret token'
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
【问题讨论】:
标签: android mapbox androidx mapbox-android