Change language programatically in Android not working for APK generated from App bundle format [duplicate]












1
















This question already has an answer here:




  • Android App Bundle with in-app locale change

    2 answers




I have a feature in my app where user can select various language at runtime from inside the app and it was working fine till I was deploying app on play store in APK format but it stopped working since i started deplyoing my app in App Bundle format. Default string resources are not being replaced with the one that user has selected but when I change whole device language from device's settings option, then my app gets updated with new configured resources from play store and everything works fine.
Is there any way I can enforce all the strings resouces to pushed along with base apk or any other way I am unaware of? Please help. The code I am using to change language is -



        Locale locale = new Locale(langCode); //langCode is the code of the language user has selected
Locale.setDefault(locale);

Resources res = parentContext.getResources();
Configuration config = res.getConfiguration();
config.setLocale(locale); // = locale;
res.updateConfiguration(config, parentContext.getResources().getDisplayMetrics());









share|improve this question















marked as duplicate by Devansh Kumar, Community Nov 13 '18 at 8:09


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    1
















    This question already has an answer here:




    • Android App Bundle with in-app locale change

      2 answers




    I have a feature in my app where user can select various language at runtime from inside the app and it was working fine till I was deploying app on play store in APK format but it stopped working since i started deplyoing my app in App Bundle format. Default string resources are not being replaced with the one that user has selected but when I change whole device language from device's settings option, then my app gets updated with new configured resources from play store and everything works fine.
    Is there any way I can enforce all the strings resouces to pushed along with base apk or any other way I am unaware of? Please help. The code I am using to change language is -



            Locale locale = new Locale(langCode); //langCode is the code of the language user has selected
    Locale.setDefault(locale);

    Resources res = parentContext.getResources();
    Configuration config = res.getConfiguration();
    config.setLocale(locale); // = locale;
    res.updateConfiguration(config, parentContext.getResources().getDisplayMetrics());









    share|improve this question















    marked as duplicate by Devansh Kumar, Community Nov 13 '18 at 8:09


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      1












      1








      1


      1







      This question already has an answer here:




      • Android App Bundle with in-app locale change

        2 answers




      I have a feature in my app where user can select various language at runtime from inside the app and it was working fine till I was deploying app on play store in APK format but it stopped working since i started deplyoing my app in App Bundle format. Default string resources are not being replaced with the one that user has selected but when I change whole device language from device's settings option, then my app gets updated with new configured resources from play store and everything works fine.
      Is there any way I can enforce all the strings resouces to pushed along with base apk or any other way I am unaware of? Please help. The code I am using to change language is -



              Locale locale = new Locale(langCode); //langCode is the code of the language user has selected
      Locale.setDefault(locale);

      Resources res = parentContext.getResources();
      Configuration config = res.getConfiguration();
      config.setLocale(locale); // = locale;
      res.updateConfiguration(config, parentContext.getResources().getDisplayMetrics());









      share|improve this question

















      This question already has an answer here:




      • Android App Bundle with in-app locale change

        2 answers




      I have a feature in my app where user can select various language at runtime from inside the app and it was working fine till I was deploying app on play store in APK format but it stopped working since i started deplyoing my app in App Bundle format. Default string resources are not being replaced with the one that user has selected but when I change whole device language from device's settings option, then my app gets updated with new configured resources from play store and everything works fine.
      Is there any way I can enforce all the strings resouces to pushed along with base apk or any other way I am unaware of? Please help. The code I am using to change language is -



              Locale locale = new Locale(langCode); //langCode is the code of the language user has selected
      Locale.setDefault(locale);

      Resources res = parentContext.getResources();
      Configuration config = res.getConfiguration();
      config.setLocale(locale); // = locale;
      res.updateConfiguration(config, parentContext.getResources().getDisplayMetrics());




      This question already has an answer here:




      • Android App Bundle with in-app locale change

        2 answers








      android android-resources android-app-bundle






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 7:59







      Devansh Kumar

















      asked Nov 13 '18 at 7:49









      Devansh KumarDevansh Kumar

      7641819




      7641819




      marked as duplicate by Devansh Kumar, Community Nov 13 '18 at 8:09


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Devansh Kumar, Community Nov 13 '18 at 8:09


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          1














          I found the solution here. Copying from there



          For the time being, you can disable the splitting by language by adding the following configuration in your build.gradle



          android {
          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
          }
          }
          }





          share|improve this answer






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            I found the solution here. Copying from there



            For the time being, you can disable the splitting by language by adding the following configuration in your build.gradle



            android {
            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
            }
            }
            }





            share|improve this answer




























              1














              I found the solution here. Copying from there



              For the time being, you can disable the splitting by language by adding the following configuration in your build.gradle



              android {
              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
              }
              }
              }





              share|improve this answer


























                1












                1








                1







                I found the solution here. Copying from there



                For the time being, you can disable the splitting by language by adding the following configuration in your build.gradle



                android {
                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
                }
                }
                }





                share|improve this answer













                I found the solution here. Copying from there



                For the time being, you can disable the splitting by language by adding the following configuration in your build.gradle



                android {
                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
                }
                }
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 '18 at 8:09









                Devansh KumarDevansh Kumar

                7641819




                7641819















                    Popular posts from this blog

                    Full-time equivalent

                    Bicuculline

                    さくらももこ