【问题标题】:Language change is working before uploading to Google Play Store but not after uploading to play store . Why?语言更改在上传到 Google Play 商店之前有效,但在上传到 Play 商店后无效。为什么?
【发布时间】:2019-07-17 07:42:47
【问题描述】:
  • 在我的应用程序中有两种语言。
  • 如果我从默认语言为英语的设备下载应用程序。那么它不会更改为中文 strings.xml (zh)。
  • 如果我将设备语言更改为中文并下载应用程序,那么它可以正常工作并更改为两种语言。可能是因为我们的默认 strings.xml 文件中有英文。

可能是因为 google play store 不允许用户下载它认为用户不需要的资源文件。

谁能帮助我?谢谢。

【问题讨论】:

    标签: java android kotlin localization google-play


    【解决方案1】:

    问题是您正在使用 .aab 文件在 play store 上发布应用程序。它会在安装时根据用户的手机设置删除本地化文件。

    要解决此问题,您需要将此行放入您的 build.gradle 文件并尝试再次上传

    android {
    
      //... removed for brevity
      bundle {
    
         language {
           enableSplit = false
         }
       }
    }
    

    Link to refer

    【讨论】:

    • 点赞!!一个简单的问题,那么 .aab 的大小呢?
    • 对DW影响不大。
    • 我认为问题是由于我们混淆了我们的应用程序,多亏了你我终于可以纠正这个问题了。
    • 很高兴能提供帮助:)
    • 不适合我,您能解释一下为什么上传后会删除语言文件吗?
    【解决方案2】:

    正如@Vrushi Patel 所说,这与 Android App Bundles 有关。要解决此问题,您必须编辑基本模块的 build.gradle 中的 android.bundle 块,如下所示,如 official documentation 中所述:

    android {
    // When building Android App Bundles, the splits block is ignored.
    splits {...}
    
    // Instead, use the bundle block to control which types of configuration APKs
    // you want your app bundle to support.
    bundle {
        language {
            // Specifies that the app bundle should not support
            // configuration APKs for language resources. These
            // resources are instead packaged with each base and
            // dynamic feature APK.
            enableSplit = false
        }
        density {
            // This property is set to true by default.
            enableSplit = true
        }
        abi {
            // This property is set to true by default.
            enableSplit = true
        }
    }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-11
      • 2013-06-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多