~/talk

Why do I have more than one Application instance?

Talkat droidcon Berlin 2022 · 2022-07-06..07-08· [android]
links:none on file
slides:none on file

App instances duplicate across processes when merged manifests from libraries declare components with a process attribute, causing secondary processes to fork and call onCreate; this produced SQLite error code 5 by concurrent access. Solution: compare current process name to package name (Android P has getProcessName; older versions read {/proc/PID/cmdline}) and only run heavy init in the main process. Also available: a small library to detect the primary process and a Gradle plugin that catches unexpected changes in the merged manifest.

AI-written summary · about

  1. 0:00Introduction and welcome
  2. 1:07Application class misconception
  3. 3:13Debugging the SQLite error
  4. 5:20Why multiple processes exist
  5. 7:12Process names in Android
  6. 9:47Detecting main process
  7. 11:14Getting process name
  8. 13:22Handling secondary processes
  9. 14:07Key takeaways
  10. 14:28Libraries for process checks
  11. 14:50Gradle plugin for manifest changes
  12. 15:56Closing and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.