Q:

How to ensure a file exists on assets folder at build time? 

I have a JSON file db_seed.json that I want to use as a seed to pre-populate local database in my Android application.  This JSON file is dynamically generated from another data source and quite big in size, so I don't want to include this in version control.  
However, each time I build the application, I want to make sure that the build process check the existence of this file in the assets folder and shout a build error if it's not (to make sure that I don't publish an incomplete APK).  Is it possible to configure Gradle in Android Studio to do this? 

A:

try this
if (! file('./app/assets/db_seed.json').exists()) {
    logger.log(LogLevel. ERROR, "file not foun")
    throw new GradleException("file not found")
}

