的build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile project(':libraries:android-ColorPickerPreference')
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:19.+'
compile files('lib/dashclock-api-r2.0.jar')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 19.1
}
}
gradle-wrapper.properties
#Fri Aug 28 03:51:32 IRDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
错误:(31,0)未找到Gradle DSL方法:'targetSdkVersion()' 可能的原因:
答案 0 :(得分:1)
您在targetSdkVersion
脚本中使用了错误的build.gradle
。
更改
targetSdkVersion 19.1
到
targetSdkVersion 19
你也应该改变(这不是你问题的原因)
apply plugin: 'android'
进入
apply plugin: 'com.android.application'
你的脚本应该如下:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0" // or 22.0.1 , 23.0.0
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
}
dependencies {
compile project(':libraries:android-ColorPickerPreference')
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:19.+'
compile files('lib/dashclock-api-r2.0.jar')
}