Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

android

nio

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?

like image 981
zeus Avatar asked Oct 22 '25 06:10

zeus


1 Answers

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.

like image 63
CommonsWare Avatar answered Oct 23 '25 19:10

CommonsWare