连接手机后直接copy了图片地址,但是 new FileInputStream时报错找不到文件


下面是全部报错信息
09/25 16:57:32: Launching 'app' on HUAWEI PCT-AL10.
$ adb shell am start -n "com.example.myapplication/com.example.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 12470 on device 'huawei-pct_al10-192.168.1.31:5555'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/HwFrameworkSecurityPartsFactory: HwFrameworkSecurityPartsFactory in.
I/HwFrameworkSecurityPartsFactory: add HwFrameworkSecurityPartsFactory to memory.
D/BehaviorCollectManager: hook process for AI virus second
I/BehaviorCollectManager: bindAnalyzerService: huawei.android.security.IAppBehaviorDataAnalyzer$Stub$Proxy@85096be pid:12470
I/e.myapplicatio: The ClassLoaderContext is a special shared library.
I/e.myapplicatio: QarthPatchMonintor::Init
QarthPatchMonintor::StartWatch
QarthPatchMonintor::WatchPackage: /data/hotpatch/fwkhotpatch/
QarthPatchMonintor::CheckAndWatchPatch: /data/hotpatch/fwkhotpatch/com.example.myapplication
QarthPatchMonintor::CheckAndWatchPatch: /data/hotpatch/fwkhotpatch/all
QarthPatchMonintor::Run
I/e.myapplicatio: QarthPatchMonintor::Reading
QarthPatchMonintor::CheckNotifyEvent
QarthPatchMonintor::CheckNotifyEvent before read
I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.myapplication#10625#256
I/HwApiCacheMangerEx: need clear apicache,because volumes changed,oldCnt=0 newCnt=1
I/HwApiCacheMangerEx: apicache path=/storage/emulated/0 state=mounted key=com.example.myapplication#10625#0
need clear apicache,because volumes changed,oldCnt=1 newCnt=1
I/AwareBitmapCacher: init processName:com.example.myapplication pid=12470 uid=10625
D/OpenGLRenderer: disableOutlineDraw is true
I/iGraphics: [0020080c] pn: com.example.myapplication, p: 12470
[0030080c] no spt app: com.example.myapplication
V/ActivityThread: callActivityOnCreate
V/HwWidgetFactory: : successes to get AllImpl object and return....
I/DecorView[]: old windowMode:0 new windoMode:1
W/e.myapplicatio: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
D/MainActivity: 经度--->114.02722624890545
纬度--->22.668723478313357
D/ActivityThread: add activity client record, r= ActivityRecord{93be516 token=android.os.BinderProxy@1784435 {com.example.myapplication/com.example.myapplication.MainActivity}} token= android.os.BinderProxy@1784435
I/DecorView[]: old windowMode:1 new windoMode:1
I/RmeSchedManager: init Rme, version is: v1.0
D/OpenGLRenderer: disableOutlineDraw is true
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
W/Gralloc3: mapper 3.x is not supported
D/HiTouch_PressGestureDetector: onAttached, package=com.example.myapplication, windowType=1, mHiTouchRestricted=false
I/HwViewRootImpl: removeInvalidNode jank list is null
D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
W/InputMethodManager: startInputReason = 1
W/InputMethodManager: startInputReason = 5
W/System: A resource failed to call close.
I/Hwaps: APS: EventAnalyzed: initAPS: version is 10.1.0.18
D/Hwaps: Fpsrequest create,type:EXACTLY_IDENTIFY
I/hwaps: HwAps: JNI_OnLoad
D/Hwaps: Fpsrequest create,type:EXACTLY_IDENTIFY
Fpsrequest create,type:OPENGL_SETTING
FpsController create
D/Hwaps: APS: EventAnalyzed: reInitFpsPara :mBaseFps = 60; mMaxFps = 60
W/Settings: Setting device_provisioned has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
V/HiTouch_HiTouchSensor: User setup is finished.
W/HwApsManager: HwApsManagerService, registerCallback, start !
D/Hwaps: APS: EventAnalyzed: registerCallbackInApsManagerService, mPkgName:com.example.myapplication; result = true
V/AudioManager: querySoundEffectsEnabled...
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@208699b
D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true
V/ActivityThread: callActivityOnCreate
I/DecorView[]: old windowMode:0 new windoMode:1
D/ActivityThread: add activity client record, r= ActivityRecord{fe5c175 token=android.os.BinderProxy@208699b {com.example.myapplication/com.example.myapplication.function2.Function2Activity}} token= android.os.BinderProxy@208699b
I/DecorView[]: old windowMode:1 new windoMode:1
D/HiTouch_PressGestureDetector: onAttached, package=com.example.myapplication, windowType=1, mHiTouchRestricted=false
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer: disableOutlineDraw is true
D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
W/InputMethodManager: startInputReason = 1
W/libEGL: EGLNativeWindowType 0x79fa02d750 disconnect failed
I/AwareBitmapCacher: init lrucache size: 2097152 pid=12470
W/Settings: Setting device_provisioned has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
V/HiTouch_HiTouchSensor: User setup is finished.
V/AudioManager: querySoundEffectsEnabled...
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@c565ac8
D/DecorView: showOrHideHighlightView: hasFocus=false; winMode=1; isMrgNull=true
V/ActivityThread: callActivityOnCreate
I/DecorView[]: old windowMode:0 new windoMode:1
I/OverScrollerOptimization: start init SmartSlideOverScroller and get the overscroller config
I/OverScrollerOptimization: get the overscroller config
D/ActivityThread: add activity client record, r= ActivityRecord{929c34 token=android.os.BinderProxy@c565ac8 {com.example.myapplication/com.example.myapplication.function2.network.AndroidNetworkActivity}} token= android.os.BinderProxy@c565ac8
I/DecorView[]: old windowMode:1 new windoMode:1
D/HiTouch_PressGestureDetector: onAttached, package=com.example.myapplication, windowType=1, mHiTouchRestricted=false
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
I/HwViewRootImpl: removeInvalidNode all the node in jank list is out of time
D/OpenGLRenderer: disableOutlineDraw is true
D/DecorView: showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
W/InputMethodManager: startInputReason = 1
W/libEGL: EGLNativeWindowType 0x79fa115210 disconnect failed
W/Settings: Setting device_provisioned has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
V/HiTouch_HiTouchSensor: User setup is finished.
V/AudioManager: querySoundEffectsEnabled...
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/System.err: java.io.FileNotFoundException: /storage/sdcard0/DCIM/Camera/IMG20170831123224.jpg: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:496)
at java.io.FileInputStream.<init>(FileInputStream.java:159)
at com.example.myapplication.function2.network.AndroidNetworkActivity$OnClick$3.run(AndroidNetworkActivity.java:222)
at java.lang.Thread.run(Thread.java:929)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
W/System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8196)
at libcore.io.IoBridge.open(IoBridge.java:482)
... 3 more
你应该是从内容提供者里获取到这个图片的地址,然后再去获取。
https://developer.android.google.cn/guide/topics/providers/content-providers
https://www.sunofbeach.net/a/1196424335795945472