Skip to content

Crash: NullPointerException when adding to CopyOnWriteArrayList during APK installation via Shizuku #168

@boombeachgame16-hue

Description

@boombeachgame16-hue

Describe the bug

The application crashes forcefully with a NullPointerException while operating with Shizuku privileges. The crash occurs on the main thread when a Runnable (executed via Handler) attempts to invoke the .add() method on an uninitialized CopyOnWriteArrayList object.
​Note: This is a persistent and 100% reproducible issue. The app crashes every single time an installation is attempted, regardless of the APK file chosen. I have also experienced the exact same crash on my previous device running Android 14, indicating it is not an OS-specific issue but a core bug in the Shizuku installation flow.
​To Reproduce
Steps to reproduce the behavior:
​Ensure Shizuku service is running and permission is granted to the package manager.
​Select any APK file from storage to install.
​Grant the "Install unknown apps" permission.
​Proceed with the installation.
​The app immediately crashes.

Logcat / Stacktrace

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.concurrent.CopyOnWriteArrayList.add(java.lang.Object)' on a null object reference
	at u7.run(r8-map-id-39d0779b43afd7997b6e3b097112c62d03d4524e606a7b8af33f75a9ff17fef3:219)
	at android.os.Handler.handleCallback(Handler.java:1029)
	at android.os.Handler.dispatchMessage(Handler.java:107)
	at android.os.Looper.loopOnce(Looper.java:274)
	at android.os.Looper.loop(Looper.java:369)
	at android.app.ActivityThread.main(ActivityThread.java:10090)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:616)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1137)

Environment:

​OS / Android Version: Android 16 - HyperOS 3 (May Security Patch)
​Previous OS Tested: Android 14 (Issue also persists here)
​Mode: Shizuku
​Additional technical context
Based on the trace, the issue originates inside the obfuscated class u7 at line 219. It seems a list used for holding data (likely related to the installation queue or package parsing via Shizuku) is declared but not properly initialized with new CopyOnWriteArrayList<>() before a background task attempts to push data to the UI thread via a Handler callback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions