0

I want to define and create custom classes in gradle to define some constants values for my projects.

We can define field under the BuildConfig as above

buildConfigField "String", 'SOME_FIELD', 'SOME_VALUE'

But I need another object not related or under the BuildConfig. And I want to use java/kotlin code. The output that I want like above.

public final class SomeClass {
    public static final String SOME_FIELD = "SOME_VALUE";
}

Is this possible to create class like that ?

Arda Kaplan
  • 1,720
  • 1
  • 15
  • 23
  • Why do you need to define a custom class in gradle? You can just define the class in Java/Kotlin. – dominicoder Apr 12 '23 at 21:51
  • I need this class why we need BuildConfig. It will have some logic depending gradle settings. – Arda Kaplan Apr 14 '23 at 09:08
  • Does this answer your question? [Build flavors for different version of same class](https://stackoverflow.com/questions/23698863/build-flavors-for-different-version-of-same-class) – dominicoder Apr 14 '23 at 14:38
  • Nope, I totaly want a different class. Neither bound to flavors nor build types. – Arda Kaplan Apr 18 '23 at 19:43
  • If not bound to flavor or build types, what is this class dependent on that you need it in a gradle file? The clearer you can be about what you're actually trying to achieve, the better odds you have of getting an answer. – dominicoder Apr 18 '23 at 20:35

0 Answers0