【问题标题】:Android app installation: Unknown failure (Failure - not installed for 0)Android应用安装:未知失败(失败-未安装为0)
【发布时间】:2017-08-21 23:55:50
【问题描述】:

应用程序在模拟器上运行良好,但我无法在我的设备(小米 Mi4)上启动应用程序。起初我用这样的文字播种对话:

Installation failed with message Failed to establish session.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?

但在我同意之后 - 我在日志中看到这条消息:

Launching app
$ adb install-multiple -r <....>
$ adb shell pm uninstall com.example.app.debug
Unknown failure (Failure - not installed for 0)
Error while Installing APKs

我已多次重启设备并将其插入/拔出计算机,但没有任何帮助。

【问题讨论】:

    标签: android adb


    【解决方案1】:

    对于 Redmi 和 Mi 设备,请关闭 MIUI 优化并重新启动您的手机。

    设置 > 开发者选项 > MIUI 优化

    【讨论】:

    • 保留用于 USB 调试和通过 USB 安装应用程序的开发人员选项
    • 你拯救了我的一天,非常感谢兄弟
    • 它无法与上述步骤一起工作,并在 miui8 redmi note 3 SD 设备上以禁用状态即时运行。有什么想法吗?
    • @JasonBourne,有时我会提到 MIUI 更新后“开发者模式”被关闭。确保它已启用。
    • 附加信息:您还应该在开发者选项中勾选“通过 USB 安装”
    【解决方案2】:

    问题出在Instant Run

    正如 Chirag Shah 所说 - 在小米设备上,您可以禁用 MIU 优化 - 当我尝试时它也对我有用。

    另一种解决方案是在 android studio 设置中禁用 Instant Run。 我记得 - 我前段时间在 Windows 上遇到过这个问题,但现在它发生在 linux(ubuntu) 上。我已经向谷歌写了错误报告,但问题仍然存在(第一次是 Android Studio 2.2.3,现在是 2.3)。

    为方便起见: 要禁用即时运行,请转到

    File->Settings->Build, Execution, Deployment->Instant Run 
    

    【讨论】:

      【解决方案3】:

      只有在开发人员选项中打开“通过 USB 安装”才对我有用。否则您可能需要关闭 MIUI 优化并重新启动,但请先尝试 USB 选项。

      【讨论】:

        【解决方案4】:

        我按照以下步骤解决了我的问题

        1. 关闭开发者选项。
        2. 再次打开开发者选项。
        3. 开启USB调试
        4. 开启通过 USB 安装

        按照我从 android studio 运行的步骤后,它已成功安装我的应用程序。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-08-31
          • 2019-03-14
          • 1970-01-01
          • 2016-02-14
          • 2015-05-07
          • 1970-01-01
          相关资源
          最近更新 更多