Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28027

Android: Build fails as duplicate string with "app_name" in i18n strings.xml file

    Details

    • Story Points:
      3
    • Sprint:
      2020 Sprint 19

      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

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              lchoudhary Lokesh Choudhary
              Reviewer:
              Gary Mathews
              Tester:
              Satyam Sekhri
            • Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration