The red mason bee (Osmia bicornis L.) is a common wild bee in urban environments which contributes to early-season pollination. We know only little about how any species of wild bee in cities responds to resource distribution or landscape structure and the urban habitat(s) that they prefer. We employed a citizen science approach to investigate drivers behind the spatial distribution of this solitary bee in the urban region of Leipzig (Germany). Volunteers hung trap nests at different locations and collected information on eight local, microsite conditions (such as sun exposure, attachment position, local flower availability). We derived 14 landscape factors from a digital GIS biotope data map (e.g. distance to flower sites and urban matrix properties such as size and edge length of patches). Both occurrence and abundance of O. bicornis were then analyzed using a combination of machine learning and multiple (logistic) regression. The results indicate that the red mason bee is ubiquitous in urban area but clearly profits from nearby floral resources. Although we expected a balanced influence of landscape factors and microsite conditions, we found that hang location of the trap nest was most important, followed by sun exposure. Cities with many fine-scaled floral resources (such as private gardens but not parks) and an open housing structure with higher sun exposure between buildings provide a good environment for cavity-nesting bees such as O. bicornis. In places without suitable nesting opportunities, artificial nest can support the bees.