{"id":734,"date":"2023-02-26T15:43:03","date_gmt":"2023-02-26T07:43:03","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=734"},"modified":"2023-04-29T17:08:58","modified_gmt":"2023-04-29T09:08:58","slug":"adb-install-failed-test-reason-for-only","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/26\/adb-install-failed-test-reason-for-only\/","title":{"rendered":"adb install INSTALL_FAILED_TEST_ONLY\u7684\u539f\u56e0"},"content":{"rendered":"<p>\u7ed9\u6d4b\u8bd5\u540c\u5b66\u6253\u4e86\u4e2adeubg\u5305\u53d1\u73b0\u65e0\u6cd5\u5b89\u88c5\uff0c\u63d0\u793a\u65e0\u6cd5\u89e3\u6790\uff0c\u4f7f\u7528<code>adb install<\/code>\u5b89\u88c5\u540e\u63d0\u793a<code>INSTALL_FAILED_TEST_ONLY<\/code>\uff0c\u539f\u6765\u662fAndroid Studio 3.0\u4f1a\u5728debug apk\u7684<code>manifest<\/code>\u6587\u4ef6<code>application<\/code>\u6807\u7b7e\u91cc\u81ea\u52a8\u6dfb\u52a0<code>android:testOnly=&quot;true&quot;<\/code>\u5c5e\u6027<\/p>\n<p>\u5728Android Studio\u8fdb\u884c\u5f00\u53d1\u7684\u65f6\u5019\uff0c\u751f\u6210\u7684<code>debug apk<\/code>\u624b\u52a8\u4f7f\u7528<code>adb install<\/code>\u65e0\u6cd5\u5b89\u88c5\uff0c\u63d0\u793a\u9519\u8bef\uff1a<\/p>\n<p><!-- more --><\/p>\n<h2>\u95ee\u9898<\/h2>\n<pre><code class=\"language-bash\">\u279c  apk adb install &#039;\/home\/yezhou\/demo\/demo-debug.apk&#039; \nadb server is out of date.  killing...\n* daemon started successfully *\n5347 KB\/s (8758206 bytes in 1.598s)\n    pkg: \/data\/local\/tmp\/demo-debug.apk\nFailure [INSTALL_FAILED_TEST_ONLY]<\/code><\/pre>\n<h2>\u5206\u6790<\/h2>\n<p>\u4f46\u662f\u4f7f\u7528Android Studio\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u53d1\u73b0\u53ef\u4ee5\u76f4\u63a5\u5b89\u88c5\u6210\u529f\u3002\u7ecf\u8fc7\u67e5\u8be2\u8d44\u6599\u53d1\u73b0\u5728<code>AndroidManifest.xml<\/code>\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e86\u5c5e\u6027<code>testOnly=true<\/code>\uff0c\u53c2\u8003\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/developer.android.com\/guide\/topics\/manifest\/application-element\">https:\/\/developer.android.com\/guide\/topics\/manifest\/application-element<\/a><\/p>\n<p>\u53cd\u7f16\u8bd1\u5f53\u524dapk\u53d1\u73b0\u6e05\u5355\u6587\u4ef6\u4e2d\u7684\u786e\u65b0\u52a0\u4e86\u8fd9\u4e2a\u5c5e\u6027\uff0c\u7814\u7a76\u53d1\u73b0\u539f\u6765\u662fAndroid Studio 3.0\u4f1a\u5728debug apk\u7684<code>manifest<\/code>\u6587\u4ef6<code>application<\/code>\u6807\u7b7e\u91cc\u81ea\u52a8\u6dfb\u52a0<code>android:testOnly=&quot;true&quot;<\/code>\u5c5e\u6027\uff0c\u5bfc\u81f4IDE\u4e2drun\u8dd1\u51fa\u7684apk\u5728\u5927\u90e8\u5206\u624b\u673a\u4e0a\u53ea\u80fd\u7528<code>adb install -t<\/code>\u6765\u5b89\u88c5\u3002<\/p>\n<h2>\u89e3\u51b3\u65b9\u6cd5<\/h2>\n<p>\u65b9\u6cd5\u4e00\uff1a\u5728\u9879\u76ee\u4e2d\u7684<code>gradle.properties<\/code>\u5168\u5c40\u914d\u7f6e\u4e2d\u8bbe\u7f6e\uff1a<\/p>\n<pre><code>android.injected.testOnly=false<\/code><\/pre>\n<p>\u65b9\u6cd5\u4e8c\uff0c\u52a0<code>-t<\/code>\u53c2\u6570\uff1a<\/p>\n<pre><code class=\"language-bash\">adb install -t app-debug.apk<\/code><\/pre>\n<p>\u901a\u8fc7\u65b9\u6cd5\u4e00\u8bbe\u7f6e\u540e\uff0c\u53cd\u7f16\u8bd1\u540e\u6ca1\u6709\u5c5e\u6027<code>testOnly=true<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9\u6d4b\u8bd5\u540c\u5b66\u6253\u4e86\u4e2adeubg\u5305\u53d1\u73b0\u65e0\u6cd5\u5b89\u88c5\uff0c\u63d0\u793a\u65e0\u6cd5\u89e3\u6790\uff0c\u4f7f\u7528adb install\u5b89\u88c5\u540e\u63d0\u793aINSTALL_F [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[202],"tags":[218],"class_list":["post-734","post","type-post","status-publish","format-standard","hentry","category-android-build","tag-adb"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/734","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=734"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/734\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}