r/androiddev • u/AdorableAmphibian425 • 14d ago
Tips and Information Difficulty understand large android codebases as an open source contributor
when i am contributing to open source and implementing changes, it feels like i dont really know whats going on with each variable and/or function. I know what the app does and how it works, and even the architecture of it, but when i want to make specific changes I struggle with actually writing the code. Especially with AI, there are easy ways to navigate and confirm what changes need to happen where. But im contributing to an android oss repo rn, and its really difficult to understand what variables come from which files and go to which files, where they are called, etc..
Is this normal? Should i learn more before contributing
3
u/Jumajim 14d ago
I'm with you on this one
2
u/kosiarska 14d ago
It depends. If codebase is extremely large then there is no way you can learn every small piece. But if you have experience you can kind of glance at modules and connect the dots quickly.
3
u/dr_bagriwrites 14d ago
This is completely normal. Most Android developers feel the same when they first open a large open source project. As someone who builds Android apps, my rule is to never try to understand the whole codebase. Pick one small change and trace only what it touches. In Android Studio, use Find Usages and Ctrl+Click to follow a variable or function across files, and keep the Call Hierarchy window open so you can see what calls what. For your first contribution, pick a self contained issue like a typo, a string update, or a small UI tweak, so you touch few files and can follow the full flow from commit to pull request.
1
u/Zhuinden 14d ago
You used to have to memorize enough of the code context to know how it's supposed to work, but these days that was automated by Claude Opus.
1
u/nikch 13d ago
That's normal. Some tricks I've found helpful in the past.
**Modifying part of the UI, and not sure where to start**: Search the code for a string that specifically appears in that part of the UI (in Android it'll be a string resource, so search for uses of that string resource) to find the parts of the code you actually need to focus on.
**Extending an existing feature**: Find the PR that implemented the feature (use `git blame` or similar to track down the commit that changed the relevant lines). Read that PR; the code, any feedback it had, etc. That'll give you a good idea of the size of the change, where the changes were made, if there are parts of the codebase you hadn't considered, etc.
**Understand your IDEs tools**: Android Studio has a number of tools to help you quickly navigate through code, trace execution and data flow, etc. Daily I use:
- Ctrl-Q on a symbol: Show the documentation for that symbol
- Ctrl-B on a symbol: Navigate between the symbol's declaration and where it's used
- Right click on a symbol, Analyze > Data flow to here (and from here): https://www.jetbrains.com/help/idea/analyzing-data-flow.html
- Debug breakpoints: Set breakpoints, run the code under the debugger, when it stops at the breakpoint review the call stack, the values of the variables at different points, etc (https://developer.android.com/studio/debug/)
**Document as you go**: As your understanding of the code improves, look for ways you can improve the documentation. If you found something that took a while to understand and is underdocumented, send a (separate!) PR to fix that documentation.
**Engage with the community**: Read recent PRs, ask questions of the maintainers. It's always OK to send a PR where you're not sure about something -- make it explicit in the description and/or comments on the PR that you don't consider it ready for a full review and you're looking for early feedback and guidance.
There are no shortcuts for this, and explicitly, AI is not going to give you better understanding. But persevere and in a few months you'll suddenly discover that you're the person answering questions from newcomers, because of the knowledge you absorbed.
And if you're looking for a project to work on, https://github.com/pachli/pachli-android/blob/main/docs/contributing/code.md