mapbox / mapbox/mapbox-navigation-android
Incorrect proguard configuration for `Mapbox_TripNotificationModuleConfiguration`
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 651
- Forks
- 321
- PR merge metrics
- No merged PRs in 30d
Description
**Mapbox Navigation SDK version:** 1.6.1
### Steps to trigger behavior
1. Create a custom trip notification as explained [here](https://docs.mapbox.com/android/navigation/guides/modularization/#replacing-a-module)
2. Enable code shrinking and obfuscation by adding `minifyEnabled true` to the `build.gradle` file
3. Build the app
### Expected behavior
The generated `Mapbox_TripNotificationModuleConfiguration` class and its nested interface `ModuleProvider` are annotated with `@Keep` rules to prevent the code shrinking tool from removing it from the app,
### Actual behavior
Only the `Mapbox_TripNotificationModuleConfiguration` has the `@Keep` annotation and the `ModuleProvider` doesn't. This forces library user to manually add a keep rule to their `proguard-rules.pro` file (e.x. `-keep interface com.mapbox.module.Mapbox_TripNotificationModuleConfiguration$ModuleProvider { *; }
`)
Here's how the generated class looks like now (the `ModuleProvider` is missing the `@Keep` annotation)
``` kotlin
/**
* Configuration provider for TripNotification module.
*/
@Keep
object Mapbox_TripNotificationModuleConfiguration {
@JvmStatic
val enableConfiguration: Boolean = true
/**
* Set this dependency provider before initializing any components of the modularized library.
*
* When you're not using the library anymore, you should pass `null` to clean up the provider
* reference and prevent memory leaks.
*/
@JvmStatic
var moduleProvider: ModuleProvider? = null
interface ModuleProvider {
fun createTripNotification(): TripNotification
}
}
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the source or generation entry point for Mapbox_TripNotificationModuleConfiguration, then compare its annotations with the nested ModuleProvider interface. Use the minifyEnabled true scenario from the issue and the proguard-rules.pro workaround to verify that the generated interface is retained without a manual keep rule.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100