我正试图从这样的图库中访问图像的图像URI。但是在尝试访问映像时,该文件始终为null并抛出找不到文件的异常。
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
这个代码几乎只是在测试图像是否为null并且给定的Uri并且它总是在那里击中。 我有一点工作,现在我不知道为什么我总是得到这个错误。
我添加了
01-31 03:58:27.251 13944-13944/XXXX.XXXX.XX E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20180123_191544.jpg (No such file or directory)
01-31 03:58:27.252 13944-13944/com.XXX.XXXX E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20180123_191544.jpg (No such file or directory)
01-31 03:58:27.252 13944-13944/XXX.XXXXXt V/image: image bitmap is null
01-31 03:58:27.257 13944-13944/XXX.XXXXXD/AndroidRuntime: Shutting down VM
01-31 03:58:27.260 13944-13944/XXX.XXXXXE/AndroidRuntime: FATAL EXCEPTION: main
Process: com.XXXX.XXXX, PID: 13944
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://com.google.android.apps.photos.contentprovider/-1/1/content://media/external/images/media/98/ORIGINAL/NONE/2117678506 flg=0x1 clip={text/uri-list U:content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F98/ORIGINAL/NONE/2117678506} }} to activity {com.XXX.XXXXX/XXX.XXXXXt.Addjob2}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
at android.app.ActivityThread.deliverResults(ActivityThread.java:4323)
到android清单文件中的权限。
请帮忙。
这是错误日志
{{1}}
答案 0 :(得分:0)