更改Android Emulator API 24中的SimCountryIso Nougat

时间:2017-08-28 15:47:23

标签: android adb appium android-7.0-nougat

到目前为止,我们正在使用此方法How do I change the Mobile Country Code (MCC) in the Android Emulator?来更改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
        }
    }
}

1 个答案:

答案 0 :(得分:6)

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

if (!attacking)
{
    if (Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < -0.5f)
    {
        //transform.Translate (new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f ));
        myRigidBody.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * currentMoveSpeed, myRigidBody.velocity.y);
        PlayerMoving = true;
        lastMove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
    }

    if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f)
    {
        //transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
        myRigidBody.velocity = new Vector2(myRigidBody.velocity.x, Input.GetAxisRaw("Vertical") * currentMoveSpeed);
        PlayerMoving = true;
        lastMove = new Vector2(0f, Input.GetAxisRaw("Vertical"));
    }
}