在Android仿真器API 24牛轧糖中更改SimCountryIso

在Android仿真器API 24牛轧糖中更改SimCountryIso,android,adb,appium,android-7.0-nougat,Android,Adb,Appium,Android 7.0 Nougat,到目前为止,我们正在使用这种方法更改sim国家/地区值。由于我们使用API 24运行模拟设备,因此模拟器将保留默认的美国国家代码 这是我们在gradle中运行它的方式: tasks.withType(Test) { systemProperties = System.getProperties() systemProperty "buildDir", "${buildDir}" systemProperty "file.encoding", "UTF8" bef

到目前为止,我们正在使用这种方法更改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
        }
    }
}

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

adb shell su root setprop gsm.sim.operator.iso-country at