How to arrange the order so that the jar file is before the Android Sdk

I’m using the android plugin for gradle. I have a custom context class that contains additional variable that I want to use. However, the plugin always prioritized the jdk for android and it will always remain at the top for the order. I’m currently using this script to forced android studio to include the jar file as a jdk, but I wish to know whether is it possible to setclasspath for certain flavour of the build.