2

Несколько дней назад мне здесь помогли с локализацией приложения на Андроид. Расписано было все полностью и по пунктам как и что сделать что бы приложение получило несколько языков. Я все сделал как было написано, но приложение не смогло изменить язык на лету. То есть я сделал 3 чекбокса с повешенным на них языком, и при выборе определенного чекбокса у меня должен меняться язык. Но как все происходит у меня: я выбираю язык нажав на чекбокс и как результат прога зависает полностью. Я пробовал на 5 и 7 андроиде, на телефонах с разной озу, но результат один и тот же. Может проблема в том что я использую чекбоксы, может в том что я неправильно перерисовываю активити, может еще в чем то я ошибся. Буду благодарен за любую помощь и советы. Вот ссылка на вопрос по локализации: Принцип локализации на Android. Вот код checkbox:

RadioGroup radGrp = findViewById(R.id.radios);
            radGrp.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() //слушатель для выбора цвета светодиода
            {
                @Override
                public void onCheckedChanged(RadioGroup arg0, int id) {
                    byte k;
                    String color = null;
                    switch (id) {

                        case R.id.red:
                            LocaleHelper.setLocale(MainActivity.this, mLanguageCode1);

                            //Пересоздаем Активити с новым языком.
                            recreate();
                            break;
                        case R.id.green:
                            LocaleHelper.setLocale(MainActivity.this, mLanguageCode2);

                            //Пересоздаем Активити с новым языком.
                            recreate();;
                            break;
                        case R.id.blue:
                            LocaleHelper.setLocale(MainActivity.this, mLanguageCode3);

                            //Пересоздаем Активити с новым языком.
                            recreate();
                            break;
                        default:
                            break;
                    }
                }
            });

        }
    }

При запуске проекта когда он строится вначале у меня выводит ошибку:

Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

Вот ошибка которая у меня выводится:

05-04 08:36:03.507 738-738/? I/art: Late-enabling -Xcheck:jni
05-04 08:36:03.507 738-738/? I/art: VMHOOK: rlim_cur : 0 pid:738
05-04 08:36:03.597 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:03.647 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_dependencies_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_dependencies_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:03.807 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:03.857 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_0_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_0_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:03.857 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:03.907 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_1_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_1_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:03.907 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:03.957 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_2_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_2_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:03.967 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:04.007 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_3_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:04.017 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:04.067 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_4_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:04.077 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:04.127 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_5_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:04.127 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:04.187 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_6_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:04.187 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:04.237 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_7_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:04.237 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:04.287 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_8_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:04.287 738-738/com.example.andrew.localization I/art: override thread count:-j4
05-04 08:36:04.337 738-738/com.example.andrew.localization W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg  --debuggable --instruction-set=arm64 --instruction-set-features=smp,a53 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m -j4 --instruction-set-variant=generic --instruction-set-features=default --dex-file=/data/app/com.example.andrew.localization-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/arm64/data@app@com.example.andrew.localization-2@split_lib_slice_9_apk.apk@classes.dex -j4) because non-0 exit status
05-04 08:36:04.337 738-738/com.example.andrew.localization W/System: ClassLoader referenced unknown path: /data/app/com.example.andrew.localization-2/lib/arm64
05-04 08:36:04.347 738-738/com.example.andrew.localization I/InstantRun: starting instant run server: is main process
05-04 08:36:04.497 738-738/com.example.andrew.localization W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
05-04 08:36:04.857 738-803/com.example.andrew.localization I/Adreno: QUALCOMM build                   : 8249e7b, Iacb76f3f7d
                                                                     Build Date                       : 03/22/16
                                                                     OpenGL ES Shader Compiler Version: XE031.06.00.05
                                                                     Local Branch                     : 
                                                                     Remote Branch                    : refs/tags/AU_LINUX_ANDROID_LA.BR.1.2.6_RB1.06.00.01.179.016
                                                                     Remote Branch                    : NONE
                                                                     Reconstruct Branch               : NOTHING
05-04 08:36:04.927 738-738/com.example.andrew.localization W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
05-04 08:36:21.757 738-749/com.example.andrew.localization I/art: Background sticky concurrent mark sweep GC freed 24590(1831KB) AllocSpace objects, 0(0B) LOS objects, 11% free, 14MB/16MB, paused 9.026ms total 83.985ms

Если будут вопросы в коментах отвечу.

3
  • Ссылка на тот вопрос должна быть в этом. И код с чекбоксами в вопрос добавьте. Скорее всего у вас там в цикл бесконечный всё валится из-за дёрганья слушателей чекбоксов.
    – ЮрийСПб
    3 мая 2018 в 19:06
  • код, с которым проблемы и стректрейс ошибки при падении приложения в вопрос необходимо добавить, чтобы получить какой то полезный ответ.
    – pavlofff
    3 мая 2018 в 23:42
  • Так что есть идеи в чем у меня проблема???
    – Andrew
    6 мая 2018 в 8:15

0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Посмотрите другие вопросы с метками или задайте свой вопрос.