Questions tagged [buildconfig]

A class created automatically by the Android Development Tools (ADT) plugin for Eclipse, with information about how the project build was configured.

94 questions
134
votes
30 answers

Gradle buildConfigField BuildConfig cannot resolve symbol

I am using Gradle to build my Android application. I am trying to use some flags based on the build type (release or debug). My Gradle file looks like this: android { buildTypes { debug { buildConfigField 'boolean',…
Gaëtan
  • 11,912
  • 7
  • 35
  • 45
94
votes
20 answers

BuildConfig not getting created correctly (Gradle Android)

I am trying to convert our Android application to a gradle build. I have the project and it's libraries building successfully. I am now trying to create separate apks for our various environments (dev/test/prod have different urls for the restful…
Innova
  • 1,751
  • 2
  • 18
  • 26
85
votes
3 answers

#if debug --> #if myOwnConfig?

is there a way in Visual Studio to use a custom Configuration like "#if DEBUG" I need a "#if OFFLINE" as my Build-Config's name is "Offline" (only for further debug-purposes too)... Thanks!
IntegerWolf
  • 1,232
  • 1
  • 11
  • 21
68
votes
7 answers

Gradle : how to use BuildConfig in an android-library with a flag that gets set in an app

My (gradle 1.10 and gradle plugin 0.8)-based android project consists of a big android-library that is a dependency for 3 different android-apps In my library, I would love to be able to use a structure like this if (BuildConfig.SOME_FLAG) { …
Lakedaemon
  • 831
  • 1
  • 6
  • 11
44
votes
7 answers

Best Way to Include Debug Code?

I am programming Android applications, and the best way here may or may not be the same as Java in general. I simply want to be able to set a debug flag that will only execute certain portions of code when it's set to true––equiv to C++ setting a…
stormin986
  • 7,672
  • 15
  • 42
  • 54
29
votes
11 answers

unresolved reference : BuildConfig in Kotlin

So I started a new android application, here is my Android Studio info Android Studio 3.6.1 Build #AI-192.7142.36.36.6241897, built on February 27, 2020 Runtime version: 1.8.0_212-release-1586-b04 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains…
MaChee Neraid
  • 603
  • 1
  • 7
  • 17
25
votes
5 answers

Gradle buildConfigField with integer variable

I would like to define a build config filed where I can use a variable defined in the gradle script it self: def someVar = 512 android { ... buildConfigField 'int', 'SOME_INT_FIELD', someVar } But this produces following error: Error:(25, 0)…
salcosand
  • 2,022
  • 4
  • 24
  • 27
17
votes
1 answer

Can I set a BuildConfig flag that returns whether or not an apk is built with the `connectedAndroidTest` gradle task?

I have parts of my app that I don't want to run if we're running Android unit tests, so I want to surround them with something like if (!BuildConfig.TESTING) { // Code here that I don't want to run during tests. } Is it possible to populate this…
Matthew
  • 6,356
  • 9
  • 47
  • 59
16
votes
3 answers

Why does the BuildConfig class use Boolean.parseBoolean() instead of literal values?

When looking at the BuildConfig class generated by Android Studio and the Gradle plugin one can see that the BuildConfig.DEBUG field is initialized using the Boolean.parseBoolean(String) call instead of using one of the boolean literals true or…
david.schreiber
  • 3,851
  • 2
  • 28
  • 46
15
votes
1 answer

applicationId manifest placeholder for multiple build flavors not working

I am modifying current android project so it can be installed on same device for multiple flavors and build configs. build.gradle: { // ... defaultConfig { applicationId "com.myapp" manifestPlaceholders = [ …
11
votes
3 answers

Why should I keep BuildConfig in ProGuard?

I've met several proguard examples with these lines: # Keep the BuildConfig -keep class com.example.BuildConfig { *; } I've run app with and without this line (of course, with my package) and haven't found any differences. I've also looked in…
NonGrate
  • 862
  • 9
  • 22
9
votes
2 answers

Where can I find my BuildConfig in the APK analyzer after minifying the code with ProGuard?

Please take a look at the following two images from Analyze APK on Android Studio. First one is with minifyEnabled = false, and another one is with minifyEnabled = true (after decoding with mapping.txt of course) minifyEnabled = false.…
barley
  • 4,403
  • 25
  • 28
8
votes
2 answers

Cannot resolve symbol c882c94be45fff9d16a1cf845fc16ec5

I am a new developer exploring the world of Android. I am currently working through the Udacity tutorials for creating the Sunshine app. In the fragment activity class in order to get data from openweathermap I must add the API key I got from my…
Kevin Rajan
  • 827
  • 8
  • 28
7
votes
4 answers

How to list all flavors in buildConfig via gradle in Android

This is a simple gradle with three flavors : apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.apipas.app.listallflavor" minSdkVersion…
Maher Abuthraa
  • 17,493
  • 11
  • 81
  • 103
6
votes
1 answer

Grails Inline Plugins: Cannot Upgrade a plugin that is configured via BuildConfig.groovy

Our app is split into a main application and a few plugins. We're using inline plugins via the BuildConfig.groovy file. When it is time to WAR the whole thing up for production I'm getting the following message: You cannot upgrade a plugin that…
Gregg
  • 34,973
  • 19
  • 109
  • 214
1
2 3 4 5 6 7