gpt4 book ai didi

java - Android Gradle非法规则

转载 作者:行者123 更新时间:2023-12-03 06:00:57 24 4
gpt4 key购买 nike

我正在尝试运行android studio项目。它不是我创造的。
但是我收到一个错误,所以我不能事件该项目。
原因是gradle scipt。我不知道项目有什么问题。因为我确定它能正常工作。

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.8.3'
}
}

allprojects {
repositories {
jcenter()
}
}

这是应用程式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

最佳答案

感谢cricket_007
从代码中删除变量signConf就可以了。
以后,请尝试更改gradle版本以按原样运行代码。

关于java - Android Gradle非法规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41782411/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com