Can I get properties defined in "gradle.properties" in JAVA STATEMENT?

Yes you can, however this is not a good idea nor a good practice. gradle.properties file is meant to keep gradle's properties itself, e.g. JVM args used at build time.

If you need to store user/pass pair in properties file, it should be placed under src/main/resources or other appropriate folder and separate from gradle.properties.

Side note: Not sure if keeping properties file in mobile application is safe in general.


You would have to read the properties file and extract the property first.

Properties prop = new Properties();
InputStream input = null;

try {

    input = new FileInputStream("gradle.properties");

    // load a properties file
    prop.load(input);

    // get the property value and print it out
    System.out.println(prop.getProperty("user.password"));
} catch (IOException ex) {
    ex.printStackTrace();
}

You can find the detailed tutorial here