Подтвердить что ты не робот

Gradle ArchivesBaseName игнорируется при использовании плагина GoogleServices

Я регулярно использовал имя архива, чтобы переименовать мой вывод 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"
      }
  }
}
4b9b3361

Ответ 1

Это перестало работать для меня с Android-версии gradle версии 1.3.0 с использованием 1.3.1. classpath '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}"
        }
    }
    //...
}