在上载到Google Play商店之前,可以进行语言更改,但在上载到Play商店后,无法进行语言更改。为什么?

时间:2019-02-23 09:31:56

标签: android localization google-play

  • 在我的应用程序中,有两种语言。
  • 如果我从使用英语作为默认语言的设备下载应用程序,则它不会更改为中文strings.xml(zh)。
  • 如果我将设备语言更改为中文并下载该应用程序,则它可以正常工作并且可以同时使用两种语言。也许是因为默认的strings.xml文件中包含英语。

也许是因为Google Play商店不允许用户下载它认为用户不需要的资源文件。

有人可以帮助我吗?谢谢。

2 个答案:

答案 0 :(得分:2)

问题是您正在使用.aab文件在Play商店上发布应用。安装时会根据用户的电话设置删除本地化文件。

要解决此问题,您需要将此行放入build.gradle文件中,然后尝试重新上传

android {

  //... removed for brevity
  bundle {

     language {
       enableSplit = false
     }
   }
}

Link to refer

答案 1 :(得分:1)

正如@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
    }
}
}
相关问题