0%

Android-Emulator-模拟器-Root和文件互传

##一 文件互传、共享

1. 快接安装app或者复制文件到模拟器

image.png

2. 文件导出

image.png

##一 Emulator 模拟器 获取 Root

一. 需要SuperSu.apk 和Recovery Flashable.zip

官网:http://www.supersu.com/download
https://supersuroot.org/downloads/?MA
百度云:https://pan.baidu.com/s/1F28p9XkIpFEGpnlFObyXmg 提取码:32iq

二 获取Root

  1. 使用Android Studio 创建模拟器
    image.png

  2. 启动模拟器

    1
    2
    3
    4
    5
    // cmd终端进入到android sdk的tools目录下
    // 查看有几个虚拟机
    ./emulator -list-avds
    // 启动模拟器(avd_name 是创建的虚拟机的名称)
    ./emulator -avd avd_name -writable-system

    image.png

  3. 安装SuperSu.apk
    上面启动模拟器的终端不要关,新开一个

    1
    2
    //apkpath SuperSu.apk路径
    adb install apkpath

    image.png

  4. 获取Root

    1
    2
    3
    .\adb root
    .\adb shell setenforce 0
    .\adb remount

    image.png

  5. Flashable.zip解压,把x86下的su.pie文件分别push到模拟器的system/bin和system/xbin目录下

    1
    2
    3
    //su.pie的路径不要有中文、空格等
    .\adb push .\x86\su.pie /system/bin/su
    .\adb push .\x86\su.pie /system/xbin/su

    image.png

  6. 修改权限,安装su

    1
    2
    3
    4
    .\adb shell chmod 0755 /system/bin/su
    .\adb shell chmod 0755 /system/xbin/su
    .\adb shell su --install
    .\adb shell "su --daemon&"

    image.png

  7. 打开SuperSu。选择CANCEL 取消就行了
    image.png

  8. 重启后root失效,重新执行

    1
    2
    3
    4
    5
    6
    7
    8
    9
    .\adb root
    .\adb shell setenforce 0
    .\adb remount
    .\adb push .\x86\su.pie /system/bin/su
    .\adb push .\x86\su.pie /system/xbin/su
    .\adb shell chmod 0755 /system/bin/su
    .\adb shell chmod 0755 /system/xbin/su
    .\adb shell su --install
    .\adb shell "su --daemon&"

参考:https://juejin.im/post/5cd2839de51d453a6c23b080