Android 如何修复google play服务版本
今天当我在建立一个程序时,我遇到了一个问题。这个问题是:Android 如何修复google play服务版本,android,google-play-services,Android,Google Play Services,今天当我在建立一个程序时,我遇到了一个问题。这个问题是: FAILURE: Build failed with an exception. Where: Build file 'C:\Users\Mert\Desktop\FireBase\platforms\android\build.gradle' line: 254 * What went wrong: A problem occurred evaluating root project 'android'. > Could n
FAILURE: Build failed with an exception.
Where:
Build file 'C:\Users\Mert\Desktop\FireBase\platforms\android\build.gradle' line: 254
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
我的代码是:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.android.support:support-v4:24.1.1+"
compile "com.google.android.gms:play-services-analytics:$GMS_VERSION"
compile "com.android.support:support-v4:$ANDROID_SUPPORT_V4_VERSION"
// SUB-PROJECT DEPENDENCIES END
}
如果你能回答这个问题,对我来说将是完美的
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
正如错误所暗示的,GMS_版本可能不会在脚本中的任何地方声明。您应该声明GMS_版本变量,或者直接提及版本,而不是使用变量
dependencies {
def GMS_VERSION = "16.0.8"
compile fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
debugCompile(project(path: "CordovaLib", configuration: "debug"))
releaseCompile(project(path: "CordovaLib", configuration: "release"))
compile "com.android.support:support-v4:24.1.1+"
compile "com.google.android.gms:play-services-analytics:$GMS_VERSION"
compile "com.android.support:support-v4:$ANDROID_SUPPORT_V4_VERSION"
// SUB-PROJECT DEPENDENCIES END
}
或者直接使用这个版本
compile "com.google.android.gms:play-services-analytics:16.0.8"
你又面临着同样的问题还是什么新问题?你能更具体地说明这个错误吗?是的,同样的问题。没有任何更改。请检查您是否在脚本的其他地方使用了GMS_版本。如异常所示,检查第254行