lwc:programming:mobile:android:global_constants

There seem to be a couple of ways to skin this cat but one way would be:

Example adding TAG DPF

In build.gradle the module not the project

buildTypes {
        release {
            ...
            buildConfigField "String", "TAG","\"DPF"\""
        }
        debug {
            ...
            buildConfigField "String", "TAG", "\"DPF\""
        }
    }
  • Then rebuild the project. Check the generated BuildConfig in the Java (generated) folder.
  • You should see something like public static final String TAG = "DPF";
  • Now use BuildConfig.TAG wherever you want to use the constant
  • lwc/programming/mobile/android/global_constants.txt
  • Last modified: 2022/02/24 10:22
  • by John Harrison