我正在尝试在我的Android应用上使用Google地图。我安装了Google Play服务,并获得了API密钥。我不明白为什么我收到此错误消息!我认为它抱怨以下。
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
错误讯息:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:support-v4:22.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom
https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar
file:/C:/Users/Ammar/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom
file:/C:/Users/Ammar/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar
file:/C:/Users/Ammar/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom
file:/C:/Users/Ammar/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar
Required by:
Client:app:unspecified > com.android.support:appcompat-v7:21.0.3
> Could not find com.android.support:support-v4:22.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom
https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar
file:/C:/Users/Ammar/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom
file:/C:/Users/Ammar/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar
file:/C:/Users/Ammar/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom
file:/C:/Users/Ammar/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar
Required by:
Client:app:unspecified > com.google.android.gms:play-services:7.0.0 > com.google.android.gms:play-services-base:7.0.0
答案 0 :(得分:4)
显然它正在寻找v4(com.android.support:support-v4)jar。你在构建路径中有它吗?
对于android studio,在dependencies
块的gradle文件中,添加以下行 -
dependencies {
compile 'com.android.support:support-v4:22.0.+'
// your other dependencies as well
}
确保您已经通过SDK管理器下载了Android支持库。如果您还没有,请参阅官方文档Support Library Setup