Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

1. android.injected.testOnly=false,或application屬性android:testOnly

Indicates whether this application is only for testing purposes. For example, it may expose functionality or data outside of itself that would cause a security hole, but is useful for testing. This kind of APK can be installed only through adb—you cannot publish it to Google Play.

Android Studio automatically adds this attribute when you click Run

android studio3.0之後,會自動為AS中直接run生成的apk添加testOnly=true屬性,造成無法在設備上安裝,錯誤如下: Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI]

解決方案:AS工程中gradle.properties文件中添加:android.injected.testOnly=false,或者application屬性android:testOnly=false

你可能感兴趣的:(Failure [INSTALL_FAILED_TEST_ONLY: installPackageLI])