我使用react-native-google-places,我按照文档操作,它在ios上完美运行。
另一方面,在android上我有这个错误:
Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-google-places'.
> Could not resolve all dependencies for configuration ':react-native-google-places:_debugPublishCopy'.
> Could not find com.google.android.gms:play-services-base:11.6.2.
Searched in the following locations:
file:/Users/Manu/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-base/11.6.2/play-services-base-11.6.2.pom
file:/Users/Manu/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-base/11.6.2/play-services-base-11.6.2.jar
file:/Users/Manu/Desktop/AwesomeProject/android/sdk-manager/com/google/android/gms/play-services-base/11.6.2/play-services-base-11.6.2.jar
file:/Users/Manu/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-base/11.6.2/play-services-base-11.6.2.pom
file:/Users/Manu/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-base/11.6.2/play-services-base-11.6.2.jar
file:/Users/Manu/Desktop/AwesomeProject/android/sdk-manager/com/google/android/gms/play-services-base/11.6.2/play-services-base-11.6.2.jar
Required by:
AwesomeProject:react-native-google-places:unspecified
> Could not find com.google.android.gms:play-services-places:11.6.2.
Searched in the following locations:
file:/Users/Manu/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-places/11.6.2/play-services-places-11.6.2.pom
...
ps:我今天也有更新android studio
有什么想法吗?
答案 0 :(得分:2)
此问题是由Google Places和软件包中的依赖项版本引起的。
您可以按照以下步骤解决此问题。
1.open /node_modules/react-native-google-places/android/build.gradle
从
更新以前的代码 compile "com.google.android.gms:play-services-base:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-places:$googlePlayServicesVersion"
compile "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
要这样改变
compile "com.google.android.gms:play-services-base:+"
compile "com.google.android.gms:play-services-places:+"
compile "com.google.android.gms:play-services-location:+"
现在使用命令
重新构建apk。react-native run-android
它将解决问题。希望对其他一些成员有用。谢谢
答案 1 :(得分:1)
我有同样的问题,我的解决方案是将此行添加到文件 android / build.gradle :
maven {
url 'https://maven.google.com'
}
抱歉我的英语不好:(