gpt4 book ai didi

android - 在 Android 的实验性 Gradle 插件中添加发布 key

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:57:38 26 4
gpt4 key购买 nike

嘿,我在添加签名我的发布构建变体时遇到了一些问题。目前我正在使用实验性的 gradle 2.5 和新的 android gradle 插件版本 0.1.0。

build.gradle:

apply plugin: 'com.android.model.application'

model {
android {
compileSdkVersion = 15
buildToolsVersion = "22.0.1"

defaultConfig.with {
applicationId = "com.testcom.test"
minSdkVersion.apiLevel = 14
targetSdkVersion.apiLevel = 14
versionCode = 1
versionName = "1.0"
}

compileOptions.with {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
}

android.ndk {
...
}

android.signingConfigs {
signed {
keyAlias = "meow"
keyPassword = "**"
storeFile = file("meow-key.keystore")
storePassword = "**"
}
}

android.buildTypes {
release {
isMinifyEnabled = false
proguardFiles += file('proguard-rules.pro')
signingConfig = signingConfigs.signed
}
debug {
isDebuggable = true
isJniDebuggable = true
}
}

// You can modify the NDK configuration for each variant.
components.android {
binaries.afterEach { binary ->
binary.mergedNdkConfig.cppFlags.add(
"-DVARIANT=\"" + binary.name + "\"")
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}

我的根build.gradle:

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

allprojects {

repositories {
jcenter()
}
}

我在运行 ./gradlew assembleRelease 时遇到的错误是:

> Exception thrown while executing model rule: model.android.buildTypes > named(release)
> Attempt to read a write only view of model of type 'java.lang.Object' given to rule 'model.android.buildTypes'

有没有人对实验性 gradle 插件有类似的问题?帮助将不胜感激。 :)

最佳答案

这个解决方法对我有用,不需要 -Dorg.gradle.model.dsl=true

model {
def signConf

android.buildTypes {
release {
signingConfig = signConf
}
}

android.signingConfigs {
create("signed") {
keyAlias = "meow"
keyPassword = "**"
storeFile = file("meow-key.keystore")
storePassword = "**"
storeType = "jks"

signConf = it
}
}
}

但是,它仅在您只有一个 signingConfig 时有效。

关于android - 在 Android 的实验性 Gradle 插件中添加发布 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32109501/

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