今天早上,Android SDK Manager通知我,有一个新的Google Play服务版本需要下载:修订版18.因此,如何找到相应的长版本号以放入我的build.gradle文件?我所有的测试设备都运行版本5.0.84,所以我尝试更新如何将Google Play服务版本与安装版本相匹配?
compile 'com.google.android.gms:play-services:4.4.52'
到
compile 'com.google.android.gms:play-services:5.0.84'
但是,这导致错误:
Gradle 'MyApp' project refresh failed: Could not find com.google.android.gms:play-services:5.0.84. Required by: {my app} Gradle settings
我运行Android工作室0.5.2并为API19构建(我还没有升级到Android L/API20):也许是这个问题?但一般来说,如何将SDK Manager中显示的修订版本号(例如18)与build.gradle的版本代码(例如5.0.84)相匹配?
这里是我的情况下,充分的build.gradle它可以帮助:
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
// Avoid "Duplicate files copied in APK" errors when using Jackson
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
// Was "compile 'com.android.support:support-v4:+'" but this caused build errors when L SDK released
compile 'com.android.support:support-v4:19.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
// Support for Google Cloud Messaging
// Was "compile 'com.android.support:appcompat-v7:+'" but this caused build errors when L SDK released
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.google.android.gms:play-services:5.0.84'
// Jackson
compile 'com.fasterxml.jackson.core:jackson-core:2.3.3'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.3.3'
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.3'
}
是的,我刚刚开始移植到Android Studio,这是一种混乱,因为我找不到方式浏览版本号(是的,我被宠爱的自动完成)。如何用'+'代替版本号应该选择最新版本。 –
在MacOSX上验证使用Android Studio中的SDK管理器安装了正确的软件包之后,可以验证存储库软件包是否已安装,并在sdk目录下的Android Studio软件包内容中找到此目录结构。路径结构是相同的。同时证实用plus替换版本号将消除当前和将来的问题。 –
@ Su-AuHwang只是使用'+'可能会产生意想不到的效果。最好像'alias installed-play-services ='ls $ {ANDROID_HOME}/extras/google/m2repository/com/google/android/gms/play-services /“'来轻松检查你已安装的东西。 –