I am trying to do a ./gradlew clean build in my flutter project. This is the error that was caught.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.mapbox.android.core.permissions.PermissionsListener found in modules common-24.8.0.aar -> jetified-common-24.8.0-runtime (com.mapbox.common:common:24.8.0) and mapbox-android-core-2.0.1.aar -> jetified-mapbox-android-core-2.0.1-runtime (com.mapbox.mapboxsdk:mapbox-android-core:2.0.1)
Duplicate class com.mapbox.android.core.permissions.PermissionsManager found in modules common-24.8.0.aar -> jetified-common-24.8.0-runtime (com.mapbox.common:common:24.8.0) and mapbox-android-core-2.0.1.aar -> jetified-mapbox-android-core-2.0.1-runtime (com.mapbox.mapboxsdk:mapbox-android-core:2.0.1)
I added
configurations.all {
resolutionStrategy {
force 'com.mapbox.common:common:24.8.0'
}
}
in gradle.build app root. But I don't think its working because the error still persists.
the pubspec for more info
name: mobile_drone_gis
description: "A new Flutter project."
publish_to: 'none'
version: 0.1.0
environment:
sdk: '>=3.3.2 <4.0.0'
dependencies:
badges: ^3.1.2
circular_menu: ^2.0.1
dio: ^5.7.0
dji: ^1.0.13
flutter:
sdk: flutter
flutter_dotenv: ^5.2.1
flutter_map: ^7.0.2
flutter_map_cancellable_tile_provider: ^3.0.2
flutter_map_geojson: ^1.0.8
fluttertoast: ^8.2.8
geojson_vi: ^2.2.5
geolocator: ^12.0.0
latlong2: ^0.9.1
the conflicting dependency would probably be DJI. But please let me know if I made a mistake.
This conflicting dependencies in your project involving Mapbox libraries. Specifically, the classes PermissionsListener and PermissionsManager are present in both com.mapbox.common:common and com.mapbox.mapboxsdk:mapbox-android-core. This conflict typically happens when two libraries depend on different versions of the same module
Modify your app/build.gradle to exclude one of the dependencies causing the conflict
configurations {
all {
exclude group: 'com.mapbox.common', module: 'common'
}
}
Alternatively, exclude the specific module
dependencies {
implementation ('com.mapbox.mapboxsdk:mapbox-android-core:2.0.1') {
exclude group: 'com.mapbox.common', module: 'common'
}
}
If you want to force a specific version of the conflicting dependency, then only adjust your app/build.gradle
configurations.all {
resolutionStrategy {
force 'com.mapbox.common:common:24.8.0'
}
}
After making the changes, run:
./gradlew clean
./gradlew build
if not works above solution then, try to follow installation step properly as per document