gpt4 book ai didi

android - 无法确定 com.google.android.gms :play-services-vision:18. 0.0 的 Artifact

转载 作者:行者123 更新时间:2023-11-29 00:53:35 28 4
gpt4 key购买 nike

我无法在 Android Studio 中构建我的项目。我正在尝试使用谷歌视觉 API 进行人脸检测,到目前为止它运行良好,但因此我无法清理/构建我的项目

这是我的构建错误信息

Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
Could not determine artifacts for com.google.android.gms:play-services-vision:18.0.0
Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-vision/18.0.0/play-services-vision-18.0.0.aar'.
Could not HEAD 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-vision/18.0.0/play-services-vision-18.0.0.aar'.
Remote host closed connection during handshake
SSL peer shut down incorrectly

这是我的 build.gradle 文件(应用级别)

apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.facedetect"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.volley:volley:1.1.1'
implementation "com.github.bumptech.glide:glide:4.9.0"
implementation 'com.github.bumptech.glide:glide:4.9.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
implementation 'com.google.android.gms:play-services-vision:18.0.0'


androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.mindorks:paracamera:0.2.2'
}
apply plugin: 'com.google.gms.google-services'

项目级build.gradle

buildscript {
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'

}
}

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

}
}

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

buildscript {

dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.3.0'
}

}

当我删除

implementation 'com.google.android.gms:play-services-vision:18.0.0

项目构建成功。我添加依赖项的方式有问题吗?

最佳答案

我认为您的依赖类路径有问题。您创建了两个构建脚本依赖项。相反,您可以在同一个构建脚本中包含一个或多个插件(依赖项)。

你可以像下面这样拥有 root build.gradle:

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0'
}
}

allprojects {
repositories {
google()
jcenter()
}
}

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

此外,您不必单独编写 google maven url maven { url 'https://maven.google.com'},因为 google()将为您做同样的事情。

关于android - 无法确定 com.google.android.gms :play-services-vision:18. 0.0 的 Artifact ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57133725/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com