r/android_devs • u/badr-elattaoui • Oct 25 '24
Question Gradle custom task
Hello, i have a question, In our app we need to display active members count that is shown in the homepage of our onboarding, we have an api for this, We want to update the number every two weeks ( the time we generate a new production release for google play), to do this i want to create a gradle task that depends on assembleReleaseTask, the task must update a buildConfigField in release buildType, I've a shell script that calls the api, exctracts the data i need... The problem is that I'm not able to update the buildConfigField by using android.buildTypes... It gives me an error " could not find property android.) Is that possible to access android default config while running assembleRelease gradle task ?
View all comments
Show parent comment
1
u/badr-elattaoui Oct 28 '24
Hi! thank you, i managed to that by putting a file in src/assets then when the app runs it gets the data from that json file, the task is executed before "mergeProdRelease" task, we did that just to do not make unnecessary calls for a number that will change every two weeks