问题描述
我需要协助...
我在尝试构建android .apk
时遇到此错误:
FAILURE: Build Failed with an exception. "Cannot invoke method buildToolsVersion() on null object"
我正在通过cmd.exe构建Windows,命令为: gradle build
from gonative.io源代码。
这是我的build.gradle文件:
apply plugin: 'android'
android {
compileSdkVersion 21 buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
applicationId "io.gonative.android.xeeyk"
versionCode 13
}
signingConfigs {
release {
storeFile file("../../release.keystore")
storePassword "password"
keyAlias "release"
keyPassword "password"
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
zipAlignEnabled true
signingConfig signingConfigs.release
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.+'
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.1.+'
}
有人能帮我吗? 预先感谢任何帮助,伊万
1楼
CommonsWare的答案可以解决问题。
将buildToolsVersion
移动到de next line解决了de问题。
对不起马克,这真的是一个超级的菜鸟问题。
这应该是build.gradle文件:
apply plugin: 'android'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
applicationId "io.gonative.android.xeeyk"
versionCode 13
}
signingConfigs {
release {
storeFile file("../../release.keystore")
storePassword "password"
keyAlias "release"
keyPassword "password"
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
zipAlignEnabled true
signingConfig signingConfigs.release
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.+'
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.1.+'
}