我试图运行android studio项目。它不是由我创造的。 但我得到一个错误,所以我不能事件凸起项目。 原因是gradle scipt。我不知道项目有什么问题。因为我确定它工作正常。
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.8.3'
}
}
allprojects {
repositories {
jcenter()
}
}
这是app gradle文件
apply plugin: 'com.android.model.application'
model {
def signConf
android {
compileSdkVersion = 20
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "com.minergate.miner"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 23
}
}
/*
* native build settings
*/
android.ndk {
moduleName = "miner"
/*
* Other ndk flags configurable here are
* cppFlags.add("-fno-rtti")
* cppFlags.add("-fno-exceptions")
* ldLibs.addAll(["android", "log"])
* stl = "system"
*/
cppFlags.add("-fexceptions")
cppFlags.add("-std=c++11")
ldLibs.add("log")
stl = "gnustl_static"
// stl = "c++_static"
}
android.buildTypes {
debug {
minifyEnabled = false
signingConfig = signConf
}
release {
minifyEnabled = true
//proguardFiles.add(file('proguard-rules.txt'))
signingConfig = signConf
}
}
android.productFlavors {
// for detailed abiFilter descriptions, refer to "Supported ABIs" @
// https://developer.android.com/ndk/guides/abis.html#sa
//create("arm") {
// ndk.abiFilters.add("armeabi")
//}
create("arm7") {
ndk.abiFilters.add("armeabi-v7a")
//signingConfig signingConfigs.miner
}
//create("arm8") {
// ndk.abiFilters.add("arm64-v8a")
//}
create("x86") {
ndk.abiFilters.add("x86")
}
//create("x86-64") {
// ndk.abiFilters.add("x86_64")
//}
//create("mips") {
// ndk.abiFilters.add("mips")
//}
//create("mips-64") {
// ndk.abiFilters.add("mips64")
//}
// To include all cpu architectures, leaves abiFilters empty
//create("all")
}
android.signingConfigs {
create("signRelease") {
keyAlias = '**'
keyPassword = '**'
storeFile = file('KeyStore')
storePassword = '**'
signConf = it
}
}
android.compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile 'com.android.support:support-v4:24.+'
compile 'com.android.support:percent:23.+'
}
我得到错误:
Error:(3, 0) Cause: startup failed: build file '...\app\build.gradle': 3: illegal rule @ line 3, column 5. def signConf ^ 1 error
答案 0 :(得分:0)
感谢cricket_007 从代码中删除变量signConf就可以了。 稍后我会尝试更改gradle版本以按原样运行代码。