gpt4 book ai didi

android - 如何使用adb shell显示本 map 片

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:54:42 25 4
gpt4 key购买 nike

我想使用 adb shell 告诉我的设备在其 SD 卡上显示图像。我认为这个命令会起作用:

adb shell am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity -d file:///storage/sdcard0/Android/data/<mypackage>/files/myfile.jpg

不幸的是我得到了这个错误:

Starting: Intent { act=android.intent.action.MAIN cmp=com.android.browser/.BrowserActivity }
Error type 3
Error: Activity class {com.android.browser/com.android.browser.BrowserActivity} does not exist.

我还尝试执行 VIEW 操作,并尝试仅使用 -n-d 参数。

adb shell am start -a android.intent.action.VIEW -d file:///storage/sdcard0/Android/data/<mypackage>/files/myfile.jpg

仅使用 -d 参数会导致此错误(我尝试在路径上使用和不使用“file://”前缀):

Starting: Intent { act=android.intent.action.VIEW dat=/storage/sdcard0/Android/data//files/myfile.jpg }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=/storage/sdcard0/Android/data//files/myfile.jpg flg=0x10000000 }

文件的权限是:

-rw-rw-r-- root     sdcard_rw   198106 2013-01-02 21:29 gUD9w5.jpg

我正在使用运行 4.1.1 的 Galaxy Nexus 进行测试。

更新:我尝试了 dtmilano 的建议,但裁剪工具弹出“无法加载图像”。来自 logcat 的堆栈跟踪是:

ActivityManager: START {dat=file:///storage/sdcard0/Android/data/<mypackage>/Pictures/myfile.jpg typ=image/* 
flg=0x13000000 cmp=com.google.android.gallery3d/com.android.gallery3d.app.CropImage u=0} from pid 301
UriImage: fail to open: file:///storage/sdcard0/Android/data/<mypackage>/Pictures/myfile.jpg
UriImage: java.io.FileNotFoundException: /storage/sdcard0/Android/data/<mypackage>/Pictures/myfile.jpg:
open failed: ENOENT (No such file or directory)
UriImage: at libcore.io.IoBridge.open(IoBridge.java:416)
UriImage: at java.io.FileInputStream.<init>(FileInputStream.java:78)
UriImage: at java.io.FileInputStream.<init>(FileInputStream.java:105)
UriImage: at android.content.ContentResolver.openInputStream(ContentResolver.java:445)
UriImage: at com.android.gallery3d.data.UriImage.openOrDownloadInner(UriImage.java:98)
UriImage: at com.android.gallery3d.data.UriImage.openFileOrDownloadTempFile(UriImage.java:78)
UriImage: at com.android.gallery3d.data.UriImage.prepareInputFile(UriImage.java:164)
UriImage: at com.android.gallery3d.data.UriImage.access$100(UriImage.java:40)
UriImage: at com.android.gallery3d.data.UriImage$RegionDecoderJob.run(UriImage.java:170)
UriImage: at com.android.gallery3d.data.UriImage$RegionDecoderJob.run(UriImage.java:168)
UriImage: at com.android.gallery3d.app.CropImage$LoadDataTask.run(CropImage.java:921)
UriImage: at com.android.gallery3d.app.CropImage$LoadDataTask.run(CropImage.java:913)
UriImage: at com.android.gallery3d.util.ThreadPool$Worker.run(ThreadPool.java:124)
UriImage: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
UriImage: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
UriImage: at java.lang.Thread.run(Thread.java:856)
UriImage: at com.android.gallery3d.util.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
UriImage: Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
UriImage: at libcore.io.Posix.open(Native Method)
UriImage: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
UriImage: at libcore.io.IoBridge.open(IoBridge.java:400)
UriImage: ... 16 more

我想知道这是不是内置 SD 卡,也许图像被视为应用程序数据,所以其他应用程序无法访问它?

最佳答案

这应该可行,但它取决于您安装的应用程序:

$ adb shell am start -t image/* -d file:///mnt/sdcard/myfile.jpg

有趣的是,如果您在Complete action using... 中选择Gallery 则不起作用,但如果您选择Crop picture 则起作用.也适用于 Astro Image Viewer

关于android - 如何使用adb shell显示本 map 片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14146223/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com