Android Studio pm 安装中止 [英] Android Studio pm install aborted

查看:44
本文介绍了Android Studio pm 安装中止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的 GS5 上从 android studio 运行一个应用程序,我得到了这个:

Im trying to run an application on my GS5 from android studio and Im getting this:

Waiting for device.
Target device: samsung-sm_g900v-f3af9744
Uploading file
local path: D:\Android\Projects\TestProject\build\outputs\apk\TestProject-debug.apk
remote path: /data/local/tmp/com.brian.testproject
Installing com.datascan.mobilescripts
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.brian.testproject"
Aborted

好像是在复制文件到设备,在/data/local/tmp目录下可以看到.它只是在pm install"阶段失败了.

It seems to be copying the file to the device, I can see it in the /data/local/tmp directory. Its just failing at the "pm install" stage.

在手机上,我打开了 USB Debugging 并授权了计算机.这是我运行 ADB 设备时得到的结果:

On the phone I turned on USB Debugging and authorized the computer. Here is what I get when I run ADB devices:

D:\Android\sdk\platform-tools>adb devices
List of devices attached
f3af9744        device

所以这似乎是正确的.我不太确定问题是什么.对此问题的 Google 搜索没有给我任何相关结果.

So that seems to be correct. Im not really sure what the problem is. Google search on the problem didnt give me any relevant results.

有谁知道如何获得中止"之外的更多信息?任何帮助表示赞赏,谢谢!

Does anyone know how to get more information beyond "Aborted"? Any help is appreciated, Thanks!

正如@AlexP 所建议的那样.我运行了adb logcat -d -s PackageManager:*",结果如下:

As suggested by @AlexP. I ran "adb logcat -d -s PackageManager:*", this was the result:

D:\Android\sdk\platform-tools>adb logcat -d -s PackageManager:*
--------- beginning of main
--------- beginning of system

没有太大帮助,但我决定在 pm install 运行时查看 logcat 并发现此错误条目:

Not much help, but I did decide to watch the logcat as the pm install was being run and I found this error entry:

Tag=appproc  |  Text= ERROR: Could not find class 'com.android.commands.pm.Pm'
Tag=art      |  Text= art.runtime/thread.cc:1105] No pending exeption expected: java.lang.ClassNotFoundException: Didn't find class "com.android.commands.pm.Pm" on path: DexPathList[[zip file "/system/framework/pm.jar"],nativeLibraryDirectories=]/vendor/lib, /system/lib]]

接着是一大堆艺术错误条目.

Followed by a whole slew of art error entries.

所以我的手机好像少了什么东西,也许吧?

So it seems as though my phone is missing something, maybe?

推荐答案

Android Studio 在 Galaxy S5 上失败的原因是因为 adbd(手机上的 ADB 服务而不是你的 PC),在这款手机的 root 版本上没有运行作为 root,这是一种安全措施.您可以通过手动尝试执行 Android Studio apk 并在设备上执行命令并发现它们无法执行,但使用su ..."重试它们来验证这一点.并看到该应用程序在设备上安装并启动.有三个选项可以解决此问题并取消阻止 Android Studio:

The reason that Android Studio fails on Galaxy S5 is because the adbd (ADB service on the phone not your PC), on rooted version of this phone does not run as root, which is a security measure. You can verify this by manually trying to execute the Android Studio apk and execute commands on the device and finding out that they are failing to execute, but retrying them using "su ..." and see that the app installs and starts on the device. There are three options to resolve this and unblock Android Studio:

选项:

  1. 刷新包含修改的 ROM - 根据我的理解,您不希望保留在库存图片上;不让 adbd 一直以 root 身份运行也是一个很好的安全措施.较旧的 rom 也属于此类别,但是您缺少 Stock Rom 更新和安全补丁.
  2. 创建一个自定义的 boot.img 并将其闪存到您的手机 - 这基本上是一个自定义内核,出于与上述选项 1 类似的原因,不需要.
  3. 在进行应用开发时使用 root 权限在您的设备上重新启动 adbd - 首选且可通过各种方法轻松实现,包括:

首选解决方案:

一个.通过终止手机上的服务并使用终端应用程序等使用su"重新启动它,以root权限(不安全模式)重新启动adbd.完成应用开发后,重启手机,adbd 将返回安全模式,恢复安全措施.

a. Restart adbd with root privileges (insecure mode) by killing the service on the phone and using a terminal app or so to restart it using "su". After you are done with your app development, restart your phone and adbd will be back in secure mode, restoring the security measures.

B.使用 Chainfire 的 ADB 不安全应用程序,该应用程序在 XDA 上免费(下载/链接如下)或在 Google Play 上付费以支持他的工作.您可以在应用程序中切换模式.在该应用中,您还可以选择在重启时自动重新启用不安全模式.

b. Use Chainfire's ADB insecure app, which is free on XDA (download/link below) or pay for it on Google Play to support his work. You can toggle the mode in the app. In the app, you also have an option to auto re-enable the insecure mode on reboots.

参考:

https://android.stackexchange.com/questions/5884/is-there-a-way-for-me-to-run-adb-shell-as-root-without-typing-in-su

http://forum.xda-developers.com/showthread.php?t=1687590(包括免费下载链接)

https://play.google.com/store/apps/details?id=eu.chainfire.adbd(用于支持 Chainfire 的工作)

https://play.google.com/store/apps/details?id=eu.chainfire.adbd (for supporting Chainfire's work)

这篇关于Android Studio pm 安装中止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆