Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28027] Android: Build fails as duplicate string with "app_name" in i18n strings.xml file

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2020-11-23T22:08:16.000+0000
Affected Version/sRelease 9.0.0
Fix Version/sRelease 9.3.0
ComponentsAndroid
Labelsandroid, i18n, localization, regression
ReporterLokesh Choudhary
AssigneeJoshua Quick
Created2020-07-16T23:43:44.000+0000
Updated2020-11-23T22:08:16.000+0000

Description

Note: This is an undocumented way of doing it. But,we need to put in a check for this.

Steps to reproduce:

1. Create an app. 2. Create a folder & a string.xml file for each locale as ./i18n/en/strings.xml & ./i18n/es/strings.xml 3. In strings.xml in en folder add:
<resources>
  <string name="app_name">Cat</string>
</resources>
4. In strings.xml in es folder add:
<resources>
  <string name="app_name">Catana</string>
</resources>
5. In the tiapp.xml add this in the android section:
<manifest android:versionCode="1" xmlns:android="http://schemas.android.com/apk/res/android">
          <application android:label="@string/app_name"/>
</manifest>
6. Build for android device/emulator.

Actual result:

The build fails with :
[ERROR] :  [GRADLE] 
[ERROR] :  [GRADLE] FAILURE: Build failed with an exception.
[ERROR] :  [GRADLE] 
[ERROR] :  [GRADLE] * What went wrong:
[ERROR] :  [GRADLE] Execution failed for task ':app:mergeDebugResources'.
[ERROR] :  [GRADLE] > /Users/lchoudhary/Desktop/workspaces/workspace_2020/AppName_i18n/build/android/app/src/main/res/values/ti_i18n_strings.xml: Error: Found item String/app_name more than one time
[ERROR] :  [GRADLE] 
[ERROR] :  [GRADLE] * Try:
[ERROR] :  [GRADLE] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[ERROR] :  [GRADLE] 
[ERROR] :  [GRADLE] * Get more help at https://help.gradle.org
[ERROR] :  [GRADLE] 
[ERROR] :  [GRADLE] BUILD FAILED in 770ms

Expected result:

The build should not fail.

Recommended Solution:

The official cross-platform way of localizing app name is via an i18n "app.xml" file as documented here... https://docs.appcelerator.com/platform/latest/#!/guide/Internationalization-section-src-29004892_Internationalization-Appnamelocalization

Comments

  1. Joshua Quick 2020-07-24

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/11841
  2. Satyam Sekhri 2020-10-07

    FR Passed Waiting for Jenkins build
  3. Satyam Sekhri 2020-11-23

    Verified on: Mac OS: 10.15.4 SDK: 9.3.0.v20201123121926 Appc CLI: 8.1.1 JDK: 11.0.6 Node: 12.16.1 Studio: 6.0.0.202005141803 Device: Pixel 3 XL(v11.0) emulator

JSON Source