我们试图利用
com.google.android.gms:play-services-location
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-location</artifactId>
<version>17.0.0</version>
</dependency>
...
<repositories>
<repository>
<id>google-local-repo</id>
<name>Google Maven Repo</name>
<url>file:///Users/sjain68/Library/Android/sdk/extras/google/m2repository</url>
</repository>
<repository>
<id>google-remote-repo</id>
<name>Google Maven Repo</name>
<url>https://maven.google.com</url>
</repository>
</repositories>
不管我们怎么努力,我们都会遇到这样的错误:
[ERROR] Failed to execute goal on project android: Could not resolve dependencies for project com.google.zxing:android:apk:4.7.10: Failure to find com.google.android.gms:play-services-location:jar:17.0.0 in https://maven.google.com was cached in the local repository, resolution will not be reattempted until the update interval of google-remote-repo has elapsed or updates are forced -> [Help 1]
这是真的。罐子不存在。这是一个AAR文件。我们如何告诉maven查找AAR文件而不是JAR?
$ wget https://maven.google.com/com/google/android/gms/play-services-location/17.0.0/play-services-location-17.0.0.aar
--2019-06-27 13:19:49-- https://maven.google.com/com/google/android/gms/play-services-location/17.0.0/play-services-location-17.0.0.aar
Resolving maven.google.com (maven.google.com)... 172.217.3.195
Connecting to maven.google.com (maven.google.com)|172.217.3.195|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-location/17.0.0/play-services-location-17.0.0.aar [following]
--2019-06-27 13:19:50-- https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-location/17.0.0/play-services-location-17.0.0.aar
Resolving dl.google.com (dl.google.com)... 216.58.193.78
Connecting to dl.google.com (dl.google.com)|216.58.193.78|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 128878 (126K) [application/octet-stream]
Saving to: âplay-services-location-17.0.0.aarâ
play-services-location-17.0.0.aar 100%[==========================================================>] 125.86K --.-KB/s in 0.03s
2019-06-27 13:19:50 (4.81 MB/s) - âplay-services-location-17.0.0.aarâ saved [128878/128878]