gpt4 book ai didi

android - 使用 GoogleServices 插件时忽略 Gradle ArchivesBaseName

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:10:05 27 4
gpt4 key购买 nike

我经常使用 archivesbasename 重命名我的输出 apk,但由于使用了 google-services 插件,它被忽略了。我能做些什么来让它再次工作吗?

在下面附上我的完整 build.gradle,感谢任何指点。

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

project.archivesBaseName = "MyApp";

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "org.codechimp.myapp"
versionCode 205
versionName "2.4"
minSdkVersion 14
targetSdkVersion 22
}

productFlavors {
prod {
}

dev {
versionName = android.defaultConfig.versionName + " dev"
}
}

signingConfigs {
debug {
storeFile file("debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
release }

buildTypes {
debug {
debuggable true
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:22.2.0'
compile 'com.google.android.gms:play-services-drive:7.5.0'
compile 'com.google.android.gms:play-services-plus:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
compile 'com.google.android.gms:play-services-identity:7.5.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.afollestad:material-dialogs:0.6.2.4'
compile 'com.google.code.gson:gson:2.3'
compile 'com.github.andrew-codechimp:androidutils:1.19'
}

def Properties props = new Properties()
props.load(new FileInputStream(file('signing.properties')))

if (props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
android.buildTypes.release.signingConfig = null
}

项目级build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.google.gms:google-services:1.3.0-beta1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
}

最佳答案

这对我停止了 android gradle 插件版本 1.3.0 使用 1.3.1 解决它。类路径 'com.android.tools.build:gradle:1.3.1'

在您的应用程序的 build.gradle 中,您可能有这个。

android {
//...
defaultConfig {
//...
archivesBaseName = "myprojectname_v${versionName}_${versionCode}"
}
//...
}

如果您想根据构建类型更改 APK 名称。

android {
//...
buildTypes {
special {
//...
archivesBaseName = "myprojectname_special_v${versionName}_${versionCode}"
}
}
//...
}

关于android - 使用 GoogleServices 插件时忽略 Gradle ArchivesBaseName,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30954046/

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