久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

以編程方式安裝 Android apk 作為測試框架的一部分

Installing an Android apk programmatically as part of a test framework(以編程方式安裝 Android apk 作為測試框架的一部分)
本文介紹了以編程方式安裝 Android apk 作為測試框架的一部分的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在嘗試以編程方式安裝 apk,但運氣不佳.我正在建立一個針對物理設備的自動化測試框架,我想讓測試設備在運行測試之前從構建服務器檢索最新的 apk.雖然我知道沒有一般的方法可以在未經用戶同意的情況下實際安裝 apk,但我很好奇在開發人員同時擁有 apk 和設備的情況下是否有可用的方法.

I'm attempting to install an apk programmatically, but I'm not having much luck. I'm setting up an automated test framework targeting physical devices, and I want to have the test devices retrieve the latest apk from the build server before running tests. While I am aware that there is no general way to actually install an apk without the user's consent, I'm curious if there might be some approach available in the case where a developer owns both the apk and device.

我過去嘗試過的方法(apk 已下載到 pathName/apkFilename):

Approaches I've tried in the past (the apk has been downloaded to pathName/apkFilename):

String command = "adb install " + pathName + apkFilename;
Runtime.getRuntime().exec(command);

還有:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(pathName + apkFilename)), "application/vnd.android.package-archive");
getActivity().startActivity(intent);

雖然我無法讓第一種方法正常工作,但第二次嘗試會創建一個系統對話框,要求用戶確認安裝(幾乎就在那里,但并不完全).由于它是一個系統對話框,很遺憾,我無法使用 Robotium 進行確認.

While I haven't been able to get the first approach to work, the second attempt creates a system dialog asking the user to confirm the installation (so almost there, but not quite). Since it is a System dialog, I, unfortunately, cannot use Robotium to confirm.

推薦答案

很多人都在嘗試解決類似的問題.我相信在沒有確認的情況下可能無法安裝 APK,至少不容易:

A lot of people are trying to solve similar problems. I believe it may not be possible to install an APK without confirmation, at least not easily:

  • 在 Android 設備上靜默安裝

我已經接受了一段時間,即不可能在 Android 上靜默安裝應用程序

I've accepted for a while now that it's impossible to silently install an application on Android

  • 靜默安裝應用,并授予 INSTALL_PACKAGES 權限
  • 您不能靜默安裝應用程序,Android 不支持它,原因很明顯.應用程序安裝需要用戶干預才能繼續.

    You cannot silently install app, its not supported by Android for obvious reasons. Application installation requires user intervention to continue.

    解決方法?

    您需要該應用擁有 android.permission.INSTALL_PACKAGES 權限.

    如果您有某些特權,這些線程上有一些關于如何執行此操作的提示,但可能很難讓您的應用以這種方式運行.您可能必須安裝到一個特殊目錄,和/或您可能必須以特殊用戶身份運行(這可能很難做到).

    There are some hints on those threads about how to do this if you have certain priveleges, though it might be hard to get your app to run that way. You might have to install to a special directory, and/or you might have to run as a special user (which might be hard to do).

    以提升的權限運行應用程序的一種可能方法:如何通過 Android SDK 獲得 root 權限?

    One possible way to run the app with elevated permissions: How can I get root permissions through the Android SDK?

    在此線程上,他們提到您可能必須root";您的手機以啟用該權限:

    On this thread, they mention you might have to "root" your phone to enable that permission:

    • http://www.anddev.org/androidpermissioninstall_packages_not_granted-t5858.html

    如果這會使保修失效,我不會感到驚訝.您在帖子的評論中提到您無法控制設備",因此也可能會取消此選項.

    I wouldn't be surprised if this voids the warranty though. You mentioned in the comments on your post that you don't have "control over the device", so that might kill this option too.

    在這個線程中提到了一些應用程序使用的漏洞,但我認為它們不受支持.如果他們仍然工作,他們可能會在某個時候停止工作.

    There is some mention on this thread of exploits that some apps use, but I don't think they're supported. If they still work, they might stop working at some point.

    這篇關于以編程方式安裝 Android apk 作為測試框架的一部分的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

    【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 波霸ol一区二区 | 国产激情综合五月久久 | 成人欧美一区二区三区黑人孕妇 | 成人免费大片黄在线播放 | 天天操天天摸天天爽 | 久久久久国产一区二区三区 | 欧美激情精品久久久久久 | 亚洲精品视频在线看 | 欧美精品一区二区三区四区 在线 | www.成人免费视频 | 91在线观| 欧洲精品视频一区 | 有码在线 | 亚州春色| 精品久久久久久久久久久下田 | 欧美精品久久久久久久久老牛影院 | 999热在线视频 | 亚洲精品毛片av | 91国在线高清视频 | 日韩av第一页 | 欧美综合一区二区三区 | 午夜视频免费在线观看 | 欧美中文字幕在线观看 | 国产精品区二区三区日本 | 日韩成人免费视频 | 国产一区二区三区四区 | 欧美精品久久久久久久久久 | 欧美日韩中文字幕 | 国产高清自拍视频在线观看 | 午夜电影网址 | 电影午夜精品一区二区三区 | 97天天干| 色综合一区二区三区 | 国产91视频一区二区 | 综合久久久 | 精品国产青草久久久久96 | 天天爱天天操 | 国产精品一区二区三区久久久 | 久久国产精品久久久久久 | 午夜视频在线播放 | 综合久久亚洲 |