問題描述
我剛剛更新了模擬器 26.0.3,現(xiàn)在我無法為新創(chuàng)建的模擬器運行 adb root
命令.
I have just updated emulator 26.0.3, now I cannot run adb root
command for new created emulator.
顯示的錯誤如下:
adbd 無法在生產版本中以 root 身份運行
我已經殺死并重新啟動 adbd
比如:
I have killed and restart adbd
like:
adb kill-server
adb devices
沒有任何幫助,有什么想法嗎?
Nothing helps, any ideas?
我不確定有什么區(qū)別以及如何選擇不同的構建,但是,如果在創(chuàng)建時啟用了以下設置,則它具有 root.
I am not sure what is the difference and how to select different build but, if following settings are enabled while creating, then it has root.
推薦答案
要啟用 root 訪問權限: 選擇未標記為Google Play"的模擬器系統(tǒng)映像.(標簽文本和其他 UI 細節(jié)因 Android Studio 版本而異.)
To enable root access: Pick an emulator system image that is NOT labelled "Google Play". (The label text and other UI details vary by Android Studio version.)
例外情況:截至 2020 年 10 月 8 日,Release R Android TV"系統(tǒng)映像不會以 root 身份運行.解決方法:改用 Release Q(API 級別 29)Android TV 系統(tǒng)映像.
Exception: As of 2020-10-08, the Release R "Android TV" system image will not run as root. Workaround: Use the Release Q (API level 29) Android TV system image instead.
測試它:啟動模擬器,然后運行 ??adb root
.應該說
Test it: Launch the emulator, then run adb root
. It should say
以root身份重啟adbd
或
adbd 已經以 root 身份運行
不是
adbd 無法在生產版本中以 root 身份運行
替代測試:運行adb shell
,如果提示以$
結尾,運行su
.它應該顯示 #
提示符.
Alternate test: Run adb shell
, and if the prompt ends with $
, run su
. It should show a #
prompt.
步驟:安裝和使用可以以root身份運行的模擬器鏡像:
Steps: To install and use an emulator image that can run as root:
- 在 Android Studio 中,使用菜單命令 Tools >AVD 管理器.
- 點擊 + 創(chuàng)建虛擬設備... 按鈕.
- 選擇虛擬硬件,然后點擊下一步.
- 選擇一個系統(tǒng)映像.
- 選擇任何不說(Google Play)"的圖片在目標"列中.
- 如果您依賴 Google API(Google Sign In、Google Fit 等),請選擇標有(Google API)"的圖片.
- 您可能需要從推薦"切換到分組到x86 圖像";或其他圖像"組找到一個.
- In Android Studio, use the menu command Tools > AVD Manager.
- Click the + Create Virtual Device... button.
- Select the virtual Hardware, and click Next.
- Select a System Image.
- Pick any image that does NOT say "(Google Play)" in the Target column.
- If you depend on Google APIs (Google Sign In, Google Fit, etc.), pick an image marked with "(Google APIs)".
- You might have to switch from the "Recommended" group to the "x86 Images" or "Other Images" group to find one.
- 提示:以 API 級別編號開頭的 AVD 名稱,以便虛擬設備列表按 API 級別排序.
[信用屬于@Merk,但這應該作為答案而不是評論發(fā)布.]
[Credit belongs to @Merk but this should be posted as an answer rather than a comment.]
這篇關于ADB root 無法在模擬器上運行(無法在生產版本中以 root 身份運行)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!