要求:项目:app > com.google.android.libraries.places:places:2.4.0

问题描述 投票:0回答:2

我正在尝试在我的应用程序中实现由 Google 提供支持的 PlaceAutoComplete。但我无法做到这一点...我已经在应用程序级 build.gradle 文件中实现了所需的依赖项并编写代码。但是当我运行该应用程序时,它给了我以下错误。 看到这个...

Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.android.volley:volley:1.1.1.
- https://dl.google.com/dl/android/maven2/com/android/volley/volley/1.1.1/volley-1.1.1.pom
- https://repo.maven.apache.org/maven2/com/android/volley/volley/1.1.1/volley-1.1.1.pom
Required by:
     project :app > com.google.android.libraries.places:places:2.4.0
Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

我上网冲浪,但找不到任何关于这件事的帮助。

这是 Gradle 代码...

plugins {
    id 'com.android.application'
    id 'com.google.gms.google-services'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.3"

    defaultConfig {
        applicationId "com.fyp.biketracker"
        minSdkVersion 19
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

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

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.fragment:fragment:1.3.6'
    implementation "com.google.android.libraries.places:places:2.4.0"
    implementation 'com.google.android.gms:play-services-maps:17.0.1'
    implementation 'com.google.android.gms:play-services-location:18.0.0'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.firebase:firebase-firestore:23.0.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    //for multidex
    implementation 'androidx.multidex:multidex:2.0.1'

    //Circle ImageView
    implementation 'de.hdodenhof:circleimageview:3.1.0'
}
java android android-studio google-places-api placeautocompletefragment
2个回答
0
投票

正如您在这里看到的:

https://mvnrepository.com/artifact/com.android.volley/volley/1.1.1

有两个存储库具有该库的特定版本:spring 存储库和 AndroidUtils 存储库。因此,您需要将其中任何一个添加到 gradle 文件的“存储库”部分,如下所示:

repositories {
        mavenCentral()
        maven {
            url "https://repo.spring.io/libs-release/"
        }
    }

这很可能是因为 Maven 中心仅包含较新的版本:

https://mvnrepository.com/artifact/com.android.volley/volley


0
投票

在build.gradle(app)中添加volley库

implementation ("com.android.volley:volley:1.2.1")

然后修复你的错误。

© www.soinside.com 2019 - 2024. All rights reserved.