1. 程式人生 > 其它 >adb install 報錯:INSTALL_FAILED_TEST_ONLY

adb install 報錯:INSTALL_FAILED_TEST_ONLY

技術標籤:android安卓android studio

問題描述

  • adb install 安裝apk時,報如下錯誤:Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

解決方法

方法一: 加引數 -t

adb install -t test.apk

方法二:在Android Studio專案中的gradle.properties全域性配置中設定如下,可取消自動在apk新增 android:testOnly="true" 屬性。

android.injected.testOnly=false

詳細分析

  • Android Studio 3.0後預設在debug apk中的manifest中新增 android:testOnly="true"
    屬性,帶該屬性的apk需要使用 adb install -t 命令安裝。

  • 官網關於adb install -t 說明如下:

參考連結

  1. 禁止 android studio 3.0 自動新增android:testOnly="true"
  2. INSTALL_FAILED_TEST_ONLY的原因
  3. <application> | Android 開發者
  4. Android 除錯橋 (adb) | Android開發者