Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Краш при попытке работы с ДСЛ #4

Open
Maksim2355 opened this issue Apr 7, 2022 · 4 comments
Open

Краш при попытке работы с ДСЛ #4

Maksim2355 opened this issue Apr 7, 2022 · 4 comments
Assignees
Labels

Comments

@Maksim2355
Copy link

Запускаю на эмуляторе pixel api 31 следующий код в методе onCreate в классе-наследнике Application

initStrictMode(enable = true, enableDefaults = false) {
    threadPolicy {
        diskWrites = true

        penalty {
            log = true
            dialog = true
        }
    }
}

Выпадает краш при запуске приложения

Caused by: java.lang.NullPointerException: Attempt to read from field 'int android.os.StrictMode$VmPolicy.mask' on a null object reference

@kirich1409
Copy link
Collaborator

Нужен полный лог

@kirich1409 kirich1409 self-assigned this Apr 8, 2022
@kirich1409 kirich1409 added the bug label Apr 8, 2022
@Maksim2355
Copy link
Author

Maksim2355 commented Apr 11, 2022

java.lang.RuntimeException: Unable to create application ru.android.demo.App: java.lang.NullPointerException: Attempt to read from field 'int android.os.StrictMode$VmPolicy.mask' on a null object reference
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6730)
        at android.app.ActivityThread.access$1500(ActivityThread.java:247)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
     Caused by: java.lang.NullPointerException: Attempt to read from field 'int android.os.StrictMode$VmPolicy.mask' on a null object reference
        at android.os.StrictMode.vmClosableObjectLeaksEnabled(StrictMode.java:2136)
        at android.os.StrictMode.setVmPolicy(StrictMode.java:2060)
        at com.kirillr.strictmodehelper.kotlin.dsl.StringModeKt.initStrictMode(StringMode.kt:32)
        at ru.android.demo.App.configStrictMode(App.kt:37)
        at ru.android.demo.App.onCreate(App.kt:27)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1211)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6725)
        at android.app.ActivityThread.access$1500(ActivityThread.java:247) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loopOnce(Looper.java:201) 
        at android.os.Looper.loop(Looper.java:288) 
        at android.app.ActivityThread.main(ActivityThread.java:7839) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 
2022-04-11 14:14:34.875 8926-8926/ru.template.debug E/FirebaseCrashlytics: Error handling uncaught exception
    java.lang.IllegalStateException: java.lang.NullPointerException: Attempt to read from field 'int android.os.StrictMode$VmPolicy.mask' on a null object reference
        at com.google.firebase.crashlytics.internal.common.Utils.awaitEvenIfOnMainThread(Utils.java:136)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController.handleUncaughtException(CrashlyticsController.java:232)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$1.onUncaughtException(CrashlyticsController.java:154)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:55)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1073)
        at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
        at java.lang.Thread.dispatchUncaughtException(Thread.java:2200)
     Caused by: java.lang.NullPointerException: Attempt to read from field 'int android.os.StrictMode$VmPolicy.mask' on a null object reference
        at android.os.StrictMode.vmIncorrectContextUseEnabled(StrictMode.java:2176)
        at android.app.ContextImpl.getSystemService(ContextImpl.java:2049)
        at android.content.ContextWrapper.getSystemService(ContextWrapper.java:857)
        at com.google.firebase.crashlytics.internal.common.CommonUtils.getAppProcessInfo(CommonUtils.java:222)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateEventApplicationData(CrashlyticsReportDataCapture.java:204)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.captureEventData(CrashlyticsReportDataCapture.java:102)
        at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistEvent(SessionReportingCoordinator.java:266)
        at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistFatalEvent(SessionReportingCoordinator.java:126)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:192)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:177)
        at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(CrashlyticsBackgroundWorker.java:105)
        at com.google.android.gms.tasks.zze.run(com.google.android.gms:play-services-tasks@@18.0.1:1)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:64)
        at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run

@kirich1409
Copy link
Collaborator

@Maksim2355, проверь не будет ли креша если сделать ту же настройку, только в напрямую через API из Android SDK. На эмуляторе воспроизвести не могу

@Maksim2355
Copy link
Author

Не, креша не будет даже если через эту либу делать. Проблемы у меня при использовании ДСЛ только. Сейчас эту либу использую, просто без dsl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants