我是Android工作室的新手。
添加lib文件后,我发现找不到classl DSL方法错误
应用程序/ build.gradel
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android {
compileSdkVersion 19
buildToolsVersion '23.0.1'
}
dependencies {
}
apply plugin: 'checkstyle'
下面是我得到错误的代码build.gradel代码。
apply plugin: 'com.android.library'
android {
compileSdkVersion 17
buildToolsVersion "19.1.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 10
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard-android-optimize.txt'
}
}
}
dependencies {
compile files('libs/core.jar')
}
有两个build.gradel,一个是app,另一个是库。
答案 0 :(得分:1)
您使用的是错误的build.gradle
文件
在顶级文件中,您无法使用 android
块:
只需从第一个build.gradle
中删除此部分即可android {
compileSdkVersion 19
buildToolsVersion '23.0.1'
}
dependencies {
}
apply plugin: 'checkstyle'