question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

app_strings fails to return locale, also fails to return default strings.xml

See original GitHub issue

The problem

First of all, this is the apk under test: https://drive.google.com/open?id=0ByLgHLmeVLK5NTlnYmhTaXlid0E And this is the string table: https://drive.google.com/open?id=0ByLgHLmeVLK5SXBsRFc5RjNkX2c

Two issues:

  1. The target app has strings.xml et el. under the default “values” folder, with only special localized strings under values-en for English; driver.app_strings only returns strings under values-en without including the default strings under values.
  2. The target app has localized strings for both zh_CN (Simplified Chinese) and zh_TW (Traditional Chinese), however, it doesn’t have any localized string for just zh, driver.app_strings fails to return the localized strings for both zh_CN & zh_TW, instead, it returns the default strings under values.

p.s. my temporary workaround for issue[1] is to pull /data/local/tmp/strings.json directly; however, it couldn’t get around issue[2].

Environment

  • Appium version (or git revision) that exhibits the issue: purely npm’s appium@1.6.5
  • Last Appium version that did not exhibit the issue (if applicable):
  • Desktop OS/version used to run Appium: Ubuntu 16.04
  • Node.js version (unless using Appium.app|exe): v8.4.0
  • Mobile platform/version under test: Android 7.1.1
  • Real device or emulator/simulator: Real Nexus 6P
  • Appium CLI or Appium.app|exe: not sure, just appium from npm (/home/mobiserver/.linuxbrew/bin/appium -> …/lib/node_modules/appium/build/lib/main.js*)

Details

Tried this on both uiautomator & uiautomator2, they both have the same issue.

Link to Appium logs

driver.app_strings when locale on mobile device is set to en https://gist.github.com/zavvio/c211645b4cb36966487a175c5e72572a driver.app_strings when locale on mobile device is set to zh_CN https://gist.github.com/zavvio/535d6bd82c83ebd8a9f1c2c0522b7a2f

Code To Reproduce Issue [ Good To Have ]

Sorry, it has some wrapper but this should be equivalent to just calling driver.app_strings

`class Suite_01(unittest.TestCase):

@classmethod
def setUpClass(cls):
    # Load configuration file
    cls.cfg = MobiConfig(EzPath.find_absolute_path("/MobileApps/config/ci/android_aio/bat_aioa_zm.cfg"))

    # Define log
    logging.config.fileConfig(EzPath.find_absolute_path(CONFIG.LOG_PATH))

    # Add some ip address to no_proxy
    SetProxy.add_to_no_proxy(cls.cfg.get("MISC", "no-proxy"))

    # Define Appium Server
    desired_caps = dict()
    desired_caps['platformName'] = cls.cfg.get("DEVICE", "platform-name")
    desired_caps['platformVersion'] = cls.cfg.get("DEVICE", "platform-version")
    desired_caps['deviceName'] = cls.cfg.get("DEVICE", "device-name")

    cls.app = MobiEzApp(cfg=cls.cfg, desired_capabilities={
                                      'automationName': "uiautomator2",
                                      'app': cls.cfg.get("APP", "aio-package"),
                                      'appPackage': "com.hp.printercontrol",
                                      'appActivity': "com.hp.printercontrol.base.PrinterControlActivity",
                                      'appWaitActivity': "com.hp.printercontrol.moobe.UiMoobeEntranceAct,com.hp.printercontrol.base.PrinterControlActivity",
                                      'fullReset': "true"})
    cls.ui = MobiUiMap(cls.app, cls.cfg.get("UI-MAP", "aio-android"), language=cls.cfg.get("DEVICE", "language"))
    print cls.app.app_strings()

`

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
zavviocommented, Sep 8, 2017

ok, there’s a pickup curve for me but I’ll try to dig into the source code.

0reactions
lock[bot]commented, Apr 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"is translated here but not found in default locale" error in ...
Running Android Studio 3.3.2 at the moment. This happens to me occasionally if I duplicate a string name in the strings.xml file (such...
Read more >
uiautomator2 driver extracts wrong strings.xml when locale is ...
The problem When Appium is started with a language + locale, ... fails to return locale, also fails to return default strings.xml #9181....
Read more >
tools:locale="en" does not remove warnings [142590628]
The string is not translated to 'en-rGB' and this is fine because there is a fallback in the default strings.xml. This is working...
Read more >
Applanga Android Localization Integration
Missing Strings Once Applanga is integrated and configured, it synchronizes your local strings with the Applanga dashboard every time you start your app...
Read more >
Connection Strings and Configuration Files - ADO.NET
Learn how to store connection strings for ADO.NET applications in an application configuration file, as a best practice for security and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found