Questions tagged [android-buildconfig]
58 questions
73
votes
4 answers
Fixing the "Build Type contains custom BuildConfig fields, but the feature is disabled" error w/ buildConfigField
In the new version of Android Studio (Flamingo | 2022.2.1 Canary 9) with the org.jetbrains.kotlin (1.8.0-Beta) plugin and 8.0.0-alpha09 gradle plugin, a new build suddenly gets this error:
Build Type 'release' contains custom BuildConfig fields,…

fattire
- 6,823
- 3
- 25
- 38
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
21
votes
2 answers
What is the buildToolsVersion for android SDK 24?
There's not much I can say about this. Oh well. Google released a new version of android called Nougat (android N). It is compileSdkVersion 24. However, on the build tools page in the official documentation, it is not mentioned.
I want to give my…

petnamedsteve
- 347
- 1
- 2
- 11
18
votes
3 answers
What is the equivalent of BuildConfig in Java module? - Android
I'm using AndroidStudio and I have the following:
Main Android project: app
Java Library: communication
I want to set up my "communication" module's gradle file to achieve the following:
As app module's gradle, I can setup variables for…

Antonio
- 11,413
- 6
- 34
- 48
13
votes
4 answers
Android Studio 3.5.2 - Error: The apk for your currently selected variant (app-release-unsigned.apk) is not signed
A little background. I have been building/debugging/testing my simple App for a few months with no problems. Build/install on AVD or my actual S9 phone. All worked just fine for months. Now, ready for my first beta release to the Play Store (my…

JJJones_3860
- 1,382
- 2
- 15
- 35
12
votes
2 answers
How to check debuggable or debug build type in android library?
I have an Android AAR library. One security policy I want to impose on the consumer application of my library, is that it must not be able to use my library when debuggable is true or the apk is created using the debug buildType.
How can I check…

Farhad
- 12,178
- 5
- 32
- 60
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
7
votes
3 answers
Combined BuildConfig variables in gradle flavor dimensions
In my Android application I have two flavor dimensions: "brand" (brand1, brand2) and "environment" (staging, production).
I added the "environment" dimension after a while and I had previously defined some BuildConfig variables for the different…

Carlo Moretti
- 2,213
- 2
- 27
- 41
6
votes
3 answers
Change BuildConfig file in Android Studio using Gradle
I am trying to add URL into my BuildConfig file using Gradle in Android Studio. So I added this code into the gradle file
buildTypes {
debug {
buildConfigField "String", "MIDTRANS_API", '"https://app.sandbox.midtrans.com/snap/v1"'
…

Asset Bekbossynov
- 1,633
- 3
- 13
- 25
5
votes
2 answers
Reach the version code and name from a library module
I'm currently working on modularizing my application, so I'm putting each feature in a library module. In one of my features, I access the version code and name. However, although I defined them in the build.gradle file specific for that…

Walid Baroudi
- 85
- 1
- 5
5
votes
2 answers
Error: Program type already present: androidx.core.R
I am having this issue when I try to do a release build.
Build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
android {
…

Isaac Sekamatte
- 5,500
- 1
- 34
- 40
3
votes
2 answers
Gradle plugin to read secret (api-key, password) properties (like buildConfigField from Android plugin)
Is there any gradle function/plugin to read/bind some secret properties (api keys, passwords) from special config/properties files?
For instance, in android plugin you can set properties in ~/.gradle/gradle.properties…

radistao
- 14,889
- 11
- 66
- 92
3
votes
0 answers
BuildConfig value is incorrect
I create one android project with Android Studio and the project contains many modules.
I want to use the buildConfigField in the build.gradle file. the following is my script.
buildTypes {
release {
minifyEnabled false
…

Liu Tom
- 397
- 2
- 9
3
votes
1 answer
Why does Picasso comment that "Do NOT pass BuildConfig.DEBUG"
https://github.com/square/picasso/blob/master/picasso/src/main/java/com/squareup/picasso/Picasso.java#L444
/**
* Toggle whether debug logging is enabled.
*
* WARNING: Enabling this will result in excessive object allocation.…

Kassadin
- 449
- 4
- 15
2
votes
1 answer
buildConfigField not working after updating gradle to 7.0.3
I updated gradle 4.0.1 to 7.0.3 because I need the support of new gradle.
I let the auto updater run and after it was done, when I run the code I get the following…

Richard
- 1,087
- 18
- 52