【问题标题】:Required by: project :app > com.google.android.libraries.places:places:2.4.0要求:项目:app > com.google.android.libraries.places:places:2.4.0
【发布时间】:2021-09-23 12:19:25
【问题描述】:

我正在尝试在我的应用程序中实现由 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'
}

【问题讨论】:

  • 发布你的 gradle 文件
  • 在你的 gradle 文件中,我看不到 volley 的任何实现

标签: java android android-studio google-places-api placeautocompletefragment


【解决方案1】:

如您所见:

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

【讨论】:

  • 没用...?
  • 可以分享一下错误信息吗?
  • 顺便说一句,如果它不重要,您可以简单地使用最新版本的 Volley (1.2.1),无需任何额外配置即可支持
  • 刚刚解决了这个问题......通过将 volley 库添加到 gradle 文件
猜你喜欢
  • 2020-12-22
  • 2021-02-25
  • 1970-01-01
  • 2021-03-05
  • 1970-01-01
  • 1970-01-01
  • 2015-08-02
  • 1970-01-01
  • 2020-10-20
相关资源
最近更新 更多