How would you approach debugging a mobile application that crashes frequently?
For this coding exercise, analyze Android crash stack traces by counting identical traces, filtering by a minimum occurrence threshold, and ranking the remaining traces. Implement analyze_crashes(crash_events, min_occurrences), where the input is a list of stack-trace strings and the output is a list of dictionaries containing stack_trace and count, sorted by descending count and then alphabetically by trace.
Constraints include up to 10^4 traces, a positive threshold, and non-empty trace strings.
def analyze_crashes(crash_events, min_occurrences):