我是android开发的新手。我想设置我的应用程序以接收位置更新,所以我将逐步按照谷歌开发教程进行操作。我在 list 文件等中创建了权限……但我对 gradle 文件有疑问。在谷歌教程上我读到我需要编译
'com.google.android.gms:play-services:8.1.18'
到我的模块 gradle 文件,所以我已经完成但无法同步 gradle 项目,它给了我错误:
Error(25, 0) gradle DSL method not found: 'compile()' The project 'name' may be using wrong version of Gradle that does not contain a method. The build file may be missing a Gradle plugin.
这是我的模块 gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.filip.whereismydevice"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
complie 'com.google.android.gms:play-services:8.1.18'
}
这是我的项目,主要的 gradle 文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
所以,我不知道可能出了什么问题,我在互联网上寻找解决方案,但没有发现同样的错误。如果已经解决了这个问题。
最佳答案
complie 'com.google.android.gms:play-services:8.1.18'
应该
compile 'com.google.android.gms:play-services:8.1.0'
笔记:
关于android - 为 google play 服务设置 gradle 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33243752/