Search code examples
javaandroidnio

Failed resolution of: java/nio/file/Paths;


In my code I do this:

import java.nio.file.Files;
import java.nio.file.Paths;


Files.createDirectories(Paths.get(mMyDir));

But I have this error on some android devices:

Failed resolution of: java/nio/file/Paths;

What can I do?


Solution

  • Set your minSdkVersion to 26 or higher, as that class is relatively new.

    Alternatively, do not use Paths. Since you have limited access to files on Android Q and higher, you may need to be considering other approaches anyway.