mercredi 5 avril 2017

Can't create directory in internal storage from instrumented test

I am trying to create a directory from an instrumented test but File.mkdirs() returns false. This is the code that I'm using:

File localARoot = InstrumentationRegistry.getContext().getDir("LocalA", Context.MODE_PRIVATE);
boolean exists = localARoot.exists();
if (!exists)
{
  exists = localARoot.mkdirs();
}
System.out.println("exists = " + exists);
-----
exists = false

How can I create this directory?

Aucun commentaire:

Enregistrer un commentaire