问题
So I'm using the mapbox-sdk for android in my project to display the map with a particular customer's location. However, simply adding mapbox has made my app extremely bulky, and I want to reduce its size by somehow excluding some of the groups/modules from mapbox in the gradle. But I don't know which ones to exclude since I don't know how to get a list of them. Is there any way to get a list of groups/modules that are automatically integrated with the integration of the mapbox sdk? Which ones should I specifically exclude?
This is the sdk that I'm using:
implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:5.2.1') {
transitive = true
}
回答1:
Use latest mapbox.
repositories {
mavenCentral()
}
dependencies {
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.0'
}
you can use exclude group like below, to remove certain dependencies:
implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.0'){
exclude group: 'group_name', module: 'module_name'
}
Run 'gradlew :app:dependencies' in your command line will print a list of dependencies.
It will show list of modules in mapbox. try excluding one or more modules as
implementation ('com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.0') { exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-sdk-turf' }
ReRun 'gradlew :app:dependencies' in your command line will print a list of dependencies, you will see that excluded library is not in list.
Note: also use 'transitive = false' if you don't want transitive dependency to be considered for dependency resolution.
来源:https://stackoverflow.com/questions/55615579/exclude-certain-groups-modules-from-mapbox-sdk