Open borbmizzet opened 2 months ago
This doesn't really look like a GrapheneOS issue.
Did you disable native debugging in security settings?
Native Code Debugging->"Block for third-party apps by default" is toggled off. I'm not an Android developer by trade. I've got a bit of experience, but I haven't done any native android development in years. I'm primarily a C++ developer, so I posted the relevant code because it looked to me like the issue was at an OS level or SDK level. All the native stuff is done by a different team here, I'm just working on some cross-platform development at the moment that overlaps with the android app.
When debugging my app in android studio, it crashes with the following error when creating the application. It does not crash if I am not using the debugger. It also seems like my collogues who do not use GrapheneOS do not have this issue, nor did I, until I switched my Pixel 8 from stock to GrapheneOS a month or two ago. My app uses both Java and C++. When I try to debug the C++ code, the app crashes as soon as the debugger is attached. When I try to debug the java code, I have verified the null value of 'processes' as described in the code I have included for context with the error log: (Built with SDK 34, GrapheneOS build 2024050700, Android Studio 2023.3.1)
2024-04-02 15:13:37.448 12152-12152 AndroidRuntime com...ndroid.apps.[redacted].debug D Shutting down VM 2024-04-02 15:13:37.450 12152-12152 AndroidRuntime com...ndroid.apps.[redacted].debug E FATAL EXCEPTION: main Process: com.[redacted].android.apps.[redacted].debug, PID: 12152 java.lang.RuntimeException: Unable to create application com.[redacted].android.[redacted].MyApplication: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7343) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2344) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8532) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:894) Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference at com.[redacted].android.[redacted].utils.AppUtils.isMainAppProcess(AppUtils.kt:yyy)
at com.[redacted].android.[redacted].MyApplication.onCreate(MyApplication.kt:zzz)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1384) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7338) at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2344) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loopOnce(Looper.java:232) at android.os.Looper.loop(Looper.java:317) at android.app.ActivityThread.main(ActivityThread.java:8532) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:894)
Things I have tried: Turning off Secure App Spawning Enabling exploit protection compatibility mode for the app Explicitly setting the app to be debugged in Developer Options