I am not able to build beta version APK of my android app. I tried below code
buildTypes {
beta {
applicationIdSuffix ".beta"
versionNameSuffix "-beta"
resValue "string", "appname", "Beta App"
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "default"
productFlavors {
free{
applicationId "com.packagename.free"
}
paid{
applicationId "com.packagename.paid"
}
}
When I try to generate APK from Genrate Signed APK button, it show error -
com.packagename.free not found
In my app, I am using payu SDK. Please help. Thanks in Advance
You have to below things to build different variants of APK.
Change you app build.gradle like
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "content_provider", "com.packagename.fileProvider"
}
staging {
signingConfig signingConfigs.release
applicationIdSuffix = ".debugStaging"
}
dexOptions {
matchingFallbacks = ['release', 'staging']
}
}
Now in open you payu build.gradle and add this line in side buildType
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
staging {
}
}
Now you have to create folder under main folder with the same name you gave in buildType "staging"
Now create a new directory inside -main->staging->java and then add your package inside java - com.packagename.debugStaging debugStaging is same as added in staging applicationIdSuffix.
Now repeat step 3 and 4 for your pay SDK folder under main directory with same name as "staging" and under this add java folder and payu package name
Final step- add your beta/staging app with packagename to firebase and download google-services.json file.
Hope this will help you.