(Original) Android installation APK error Installation failed due to: 'INSTALL_FAILED_TEST_ONLY'

This problem is encountered in vivo mobile phones and oppo mobile phones. This problem is not found in Huawei, Xiaomi and other mobile phones. This
is actually because Android Studio has a hidden function since 3.0, that is, when compiling and packaging the debug package, it will automatically Add this sentence to the manifest file of the apk package:
android:testOnly="true".
However, the Android systems customized by some domestic Android phone manufacturers do not allow the installation of test packages with this attribute.
The solution
is also very simple: prohibit Android Studio from generating This attribute is automatically added to debug type apk files.
Open the gradle.properties file in the project root directory and add a line:

android.injected.testOnly = false

As shown below:
Insert image description here

Guess you like

Origin blog.csdn.net/Android_xiong_st/article/details/128813151