I'm having trouble understanding build variants in Android studio. I created an empty project and added product flavors as follows.
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "version"
productFlavors {
demo {
applicationIdSuffix ".demo"
}
full {
applicationIdSuffix ".full"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
I synced the project with Gradle files and I only get a demo debut variant. As per my understanding, I should get,
Am I following anything wrong? Any help is greatly appreciated.
Try to manually sync your project with grade files. Use any of the below as per your Android Studio version:
Tools -> Android -> Sync Project with Gradle Files [For older Android Studio version]
File -> Sync Project with Gradle Files [For newer Android Studio versions]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With