adb run-as复制文件

发布于 2025-02-09 12:53:27 字数 674 浏览 2 评论 0原文

我有可拆除的应用程序,我需要将文件复制到电话,然后返回。我使用此命令并接收错误。

adb shell run-as app cp /data/data/app/shared_prefs/app_preferences.xml /storage/emulated/0
cp: /storage/emulated/0/app_preferences.xml: Operation not permitted

我尝试编辑文件

adb shell run-as app "echo test > /data/user/0/app/shared_prefs/app_preferences.xml"
/system/bin/sh: can't create /data/data/app/shared_prefs/app_preferences.xml: Permission denied

,但是如果我尝试使用

adb shell
run-as app
echo test > /data/user/0/app/shared_prefs/app_preferences.xml

这种方式,则可以编辑文件,但cp却没有。另外,通过Android Studio,我可以保存和上传文件。

总的来说,如何在一个命令中编辑或复制文件?

I have debbugable app, and I need to copy file to phone, and back after. I use this command and receive error.

adb shell run-as app cp /data/data/app/shared_prefs/app_preferences.xml /storage/emulated/0
cp: /storage/emulated/0/app_preferences.xml: Operation not permitted

I tryied to edit file

adb shell run-as app "echo test > /data/user/0/app/shared_prefs/app_preferences.xml"
/system/bin/sh: can't create /data/data/app/shared_prefs/app_preferences.xml: Permission denied

But if I try

adb shell
run-as app
echo test > /data/user/0/app/shared_prefs/app_preferences.xml

This way I able to edit file, but cp not. Also via Android Studio I can save and upload file.

In total, how to edit in one command or copy file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文