Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Create build config string field in android library?

I want to to have a string version in build config for my library module

I am using the below code

android {
ext{
    version = 'NW-1.1.6'
    name = 'Network'
}
defaultConfig {
    buildConfigField "String", "LIBRARY_VERSION","${version}"
}

But in my build config I see it as

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

public static final String LIBRARY_VERSION = NW-1.1.6;

instead of

public static final String LIBRARY_VERSION = "NW-1.1.6";

What is wrong with the above code

>Solution :

Just use the following

defaultConfig {
    buildConfigField "String", "LIBRARY_VERSION","\"${version}\""
}

this will produces the string you need:

public static final String LIBRARY_VERSION = "NW-1.1.6";
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading