[英]INSTALL_FAILED_TEST_ONLY in Android studio 2.4 preview 7
I'm using Android Studio 2.4 preview 7 version. 我正在使用Android Studio 2.4预览版7。 But, when I build debug apk and install via adb command or put apk file in sdcard of device it always gives me same error "App not installed" in any of android phone. 但是,当我构建调试apk并通过adb命令安装或将apk文件放入设备的SD卡时,它总是在任何Android手机中给我同样的错误“App not installed”。 I have got INSTALL_FAILED_TEST_ONLY error in Android Logcat every time at the time of installation in any android device. 每次在任何Android设备上安装时,我都会在Android Logcat中出现INSTALL_FAILED_TEST_ONLY错误。
If you analyze your apk file you'll see the problem easily - namely that when building the project with the mentioned Android Studio version, the Gradle plugin is automatically injecting an android:testOnly=true
to the final AndroidManifest.xml
file of the output apk. 如果您分析您的apk文件,您将很容易看到问题 - 即在使用上述Android Studio版本构建项目时,Gradle插件会自动将android:testOnly=true
注入到输出apk的最终AndroidManifest.xml
文件中。
You can read more about this property and what it's used for HERE . 您可以阅读有关此属性的更多信息以及它在此处使用的内容。
To workaround this problem - you can still install the app using this command: 要解决此问题 - 您仍然可以使用以下命令安装应用程序:
adb install -t debug.apk
If you want to build a signed release
version of your app (eg for publishing the Play Store), you can always do so via Build -> Generate Signed APK
. 如果您想构建应用程序的签名release
版本(例如,用于发布Play商店),您可以通过Build -> Generate Signed APK
。 The result is an apk without the mentioned property and can be installed on any device. 结果是没有提到属性的apk,可以安装在任何设备上。
If you want a bit of context why this property is injected, perhaps check THIS and THIS issues on the AOSP bug tracker. 如果你想要一些上下文为什么注入这个属性,也许在AOSP bug跟踪器上检查这个和这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.