question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

archivesBaseName in build.gradle of app module

See original GitHub issue

What is the purpose of archivesBaseName in build.gradle of app module?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ataulmcommented, Dec 19, 2018
android {
    ...

    defaultConfig {
        ...
        archivesBaseName = 'myDefaultName.'
    }

    // Specifies one flavor dimension.
    flavorDimensions "version"
    productFlavors {
        full
        demo
    }

    variantFilter { variant ->
        def name = variant.flavors*.name
        archivesBaseName = 'my-flavor-name-is-' + name + '-awesome'
    }
    ...

image

You can override archivesBaseName anywhere in the android block.

~versionNameSuffix can already be used to differentiate between APKs generated for different flavors and is the easiest way to add the build flavor in the APK name.~ Looks like it’s just taking the flavor name and build type by default.

You can have more control if you like by setting archivesBaseName in the variantFilter function, but the flavor and type are still appended.

1reaction
nickbutchercommented, Nov 18, 2015

Hi @gokhanbarisaker, archivesBaseName is a gradle convention for setting the name of the output file. I use this to customise the file name, e.g. to plaid-0.5.5-release.apk. See the gradle docs for more info.

The GIT_SHA build config isn’t currently being used. I made that available as it can be extremely useful for crash reporting (see this great article). It could be removed but I don’t see any point in doing so as it might be useful in the future and it’s nice to demonstrate this technique.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Gradle ArchivesBaseName ignored when using ...
This stopped working for me with android gradle plugin version 1.3.0 using 1.3.1 resolves it. classpath 'com.android.tools.build:gradle:1.3.1'.
Read more >
Project - Gradle DSL Version 7.6
Properties added by the java plugin. Property, Description. archivesBaseName. The base name to use for archive files.
Read more >
build.gradle - platform/frameworks/opt/sherpa - Git at Google
NOTE: Do not place your application dependencies here; they belong. // in the individual module build.gradle files. } } import com.google.common.io.Files.
Read more >
Set Android apk filename in Gradle - Taneli Korri
By default the Android gradle plugin creates app-debug.apk, ... to the add the following to the application module build.gradle file (for ...
Read more >
Gradle tips and recipes - Android Developers
Gradle and the Android plugin allow you to create different versions of your app from a single module by configuring build variants.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found