无法解决本地的 tapandpay 依赖项

Failed to resolve tapandpay dependency in local

解析失败:com.google.android.gms:play-services-tapandpay:17.1.2 来自 developers.google 的说明:

dependencies {
  // ...
  implementation 'com.google.android.gms:play-services-tapandpay:17.1.0'
  // Getting a "Could not find" error? Make sure you have added the unzipped SDK
  // location to your root build.gradle file as a local maven dependency
}
allprojects {
    // ...
    repositories {
        // ...
        google() // Google's public Maven repository
        maven { url "file:/path/to/your/repo/m2repository/" }  // Local path to the folder into which you unzipped the SDK
    }
}

ERROR:
Execution failed for task
> Could not resolve all files for configuration 
   > Could not find com.google.android.gms:play-services-tapandpay:17.1.2.
     Required by:
         project :app

找不到正确的方法

我解决了我的错误。 我添加到 build.gradle

allprojects {
    repositories {
        google()
        jcenter()
        mavenLocal()
       maven { url "file:/*pathto*/sdk/extras/google/m2repository/" }
    }
}

您可以通过以下方式解决此错误:

  1. 解压 lib 文件夹
  2. 将文件夹移动到此路径(您的 android sdk路径 Android/sdk/extras/google/m2repository)
  3. 将之前的路径添加到 build.gradle 文件
allprojects {
    repositories {
        google()
        jcenter()
         maven { url "file:*your path here*/Android/sdk/extras/google/m2repository"}
  1. 确保库版本与我们添加的依赖版本匹配。