更改Android Emulator API 24中的SimCountryIso Nougat

Cod*_*mpy 2 android adb appium android-7.0-nougat

到目前为止我们正在使用这种方法如何更改Android模拟器中的移动国家代码(MCC)?更改SIM国家/地区值.由于我们使用API​​ 24运行我们的模拟设备,因此模拟器保留默认的美国国家/地区代码.

这就是我们在gradle中运行它的方式:

tasks.withType(Test) {
    systemProperties = System.getProperties()
    systemProperty "buildDir", "${buildDir}"
    systemProperty "file.encoding", "UTF8"

    beforeTest {
        logger.info "restoring android emulator SIM country to AT"
        exec {
            commandLine "bash", "-c", "source ~/.bash_profile && adb -e shell setprop gsm.sim.operator.iso-country at
            ignoreExitValue true
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 6

对我来说,当我在AVD版本24+上以root用户身份运行此命令时,它可以正常工作:

adb shell su root setprop gsm.sim.operator.iso-country at
Run Code Online (Sandbox Code Playgroud)