java.io.FileNotFoundException
See original GitHub issueE/LogWriter: save:
java.io.FileNotFoundException: /data/com.github.piasy.bootstrap/performance/looper-2016-12-11_23-48-25.844.log (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:140)
at com.github.moduth.blockcanary.LogWriter.save(LogWriter.java:108)
at com.github.moduth.blockcanary.LogWriter.save(LogWriter.java:56)
at com.github.moduth.blockcanary.BlockCanaryInternals$1.onBlockEvent(BlockCanaryInternals.java:63)
at com.github.moduth.blockcanary.LooperMonitor$1.run(LooperMonitor.java:74)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
java.io.FileNotFoundException in Java - GeeksforGeeks
java.io.FileNotFoundException which is a common exception which occurs while we try to access a file. FileNotFoundExcetion is thrown by ...
Read more >How to Fix the FileNotFoundException in Java.io - Rollbar
The FileNotFoundException is a checked exception in Java that occurs when an attempt to open a file denoted by a specified pathname fails....
Read more >java.io.FileNotFoundException: the system cannot find the file ...
First thing you would need to do (in this particular) case is make sure that the file get built into the classpath. With...
Read more >FileNotFoundException (Java Platform SE 8 )
Signals that an attempt to open the file denoted by a specified pathname has failed. This exception will be thrown by the FileInputStream...
Read more >Solving java.io.FileNotFoundException
java.io.filenotfoundexception is thrown during a failed attempt to open the file denoted by a specified pathname.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Piasy this problem is produced when the external storage is not available or not writable. For example, the external storage is unmounted and it is really exist in some devices. When external storage is not exist, the library with choose the /data/{your_provided_dir}, but this directory is not accessible by normal app due to permission limit. the code in
BlockCanaryInternals.getPath()
have some drawback in design.There is another permission problem, the external storage is not writeable default except the app-specifical directory due to the dynamic permission mechanism since Android 6.0. So i suggest BlockCanary library can modify the implementation of
BlockCanaryInternals.getPath()
, there are two choice:BlockCanaryContext.providePath()
, the path validation is decided by user.App-specifical directory usually locates in external storage /Android/data/{pacakage_name}, you can use
Context.getExternalCacheDir()
orContext.getExternalFilesDir()
to obtain a cache directory(/cache) or a files directory(/files). Those directory do not need to declare permission in Android Mainifest since Kitkat. If abvoe path is not avaiable (external storage is unmount), useContext.getCacheDir()
orContext.getFilesDir()
instead. The result are usually located in /data/data/{pacakage_name} in internal storage and always available to normal app.A reference implementation for choice 2
@initialjie @zjupure thanks, I adopt that the path should be provided entirely by user, the library itself should not do any magic to it.