English 中文(简体)
自动改变安乐器地方
原标题:Changing the Android emulator locale automatically

For automated testing (using Hudson) I have a script that generates a bunch of emulators for many combinations of Android OS version, screen resolution, screen density and language.
This works fine, except for the language part.

我需要找到一种办法,自动改变本地的安乐系统。 在这方面,我可以认为,为了优先起见:

  • Extracting/editing/repacking a QEMU image directly before starting the emulator
  • Running some sort of system-locale-changing APK on the emulator after startup
  • Changing the locale settings on the emulator filesystem after startup
  • Changing the locale settings in some SQLite DB on the emulator after startup
  • Running a key sequence (via the emulator s telnet interface) that would open the settings app and change the locale
  • Manually starting the emulator for each platform version, changing the locale by hand in the settings, saving it and archiving the images for later deployment

任何想法,无论是通过上述方法还是通过其他方式,都能够做到?

你们是否知道系统是否坚持/利用当地环境?


Solution:
Thanks to dtmilano s info about the relevant properties, and some further investigation on my part, I came up with a solution even better and simpler than all the ideas above!

我将他的回答与细节作了更新。

最佳回答

在个人方面,我认为最简单的方式是开始推介器,可能是一个清洁的事例,除非你进行符合其他申请的融合测试,然后使用试剂改变当地情况:

$ adb shell  
setprop persist.sys.language en;
setprop persist.sys.country GB;
stop;
sleep 5;
start 

or whatever locale you want to set. To verify that your change was successful just use

$ adb shell  getprop persist.sys.language 

您还可能想在知识港管理宣传器,检查。 回答:


请注意,在启动“<>/strong>时,也可直接设定系统特性:

emulator -avd my_avd -prop persist.sys.language=en -prop persist.sys.country=GB

这样一来,你就可以创建一种便衣的老 em,然后立即使用你选择的当地人,无须,首先必须修改宣传者的形象。

这种地方性将持续下去,供养者今后经营,当然,在开业或开业期间,你总是能够再次改变。

问题回答

接受的回答不再奏效。 <代码>persist.sys.English and persist.sys.country are go from emulator property.

我的解决办法是使用“Custom locale”应用的预先.子。 简单地将具有额外语文参数的意图发送至:

adb shell am broadcast -a com.android.intent.action.SET_LOCALE --es com.android.intent.extra.LOCALE EN

https://testyour.app/blog/emulator”rel=“nofollow noretinger”>prepare android emulator for UI检测自动化。

UPDATE:根据Jonas Alves的评论,以下指挥工程涉及APIC 28+:

adb shell am broadcast -a com.android.intent.action.SET_LOCALE --es com.android.intent.extra.LOCALE "en_US" com.android.customlocale2

Seems that emulator now support establishing the locale whenstart it:

emulator -avd <avd-name> -change-locale fr-CA

资料来源:





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签