-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Source Context integration doesn't support most Android repositories #74435
Comments
Assigning to @getsentry/support for routing ⏲️ |
Routing to @getsentry/product-owners-issues-source-maps for triage ⏲️ |
Really appreciate the detail here, thank you! For full transparency, we don't have any planned work in this area at the moment but we will review and follow up when that changes. |
There is a related issue on the SAGP repo about supporting source context for multi-module setups: getsentry/sentry-android-gradle-plugin#685 |
Routing to @getsentry/product-owners-processing for triage ⏲️ |
Routing to @getsentry/product-owners-processing for triage ⏲️ |
As this is mainly a topic for our Sentry Android Gradle plugin, let's close this in favor of getsentry/sentry-android-gradle-plugin#685 |
Problem Statement
The "known limitations" of the Source Context feature on Android mentions
Package declaration and file tree must match for source lookup to work
. Most Android repositories cannot meet this requirement. A basic Android project with only one Gradle module would have a file hierarchy that looks like this:The package name of
MainActivity.kt
will becom.company.app
. The limitations say that the file must live in thecom/company/app
directory relative to the project root when in fact it will live inapp/src/main/java/com/company/app
.Package names only match file hierarchy relative to the
java
(orkotlin
) directories within their respective Gradle module. Any amount of directories can exist above that point.One "easy" fix would be to allow specifying a root directory to start looking from (
app/src/main/java
in this example), however this could easily break if the project is refactored and would also not support multi module projects which is most mature Android projects. Here's an example file hierarchy of a multi-module project:There are multiple Gradle modules, with varying numbers of layers of directories above them. Again the "easy" solution might be to allow specifying multiple source directories to search in but this would quickly become a maintenance nightmare. Real world Android projects have hundreds or even thousands of Gradle modules.
For a real example here is a Github project: https://github.com/vmadalin/android-modular-architecture
Solution Brainstorm
The
settings.gradle
file in a Gradle project could be used to find the path to each Gradle module in the project. Another option is looking forbuild.gradle
andbuild.gradle.kts
files as they appear in the root directory of a given Gradle module.However, I wouldn't be surprised if there are lots of edge cases that wouldn't be covered by these.
Product Area
Issues - Source Maps
The text was updated successfully, but these errors were encountered: