D8: Tipo de programa já presente: android.support.v4.media.MediaBrowserCompat $ CustomActionCallback
Eu sou novo no Flutter e construo um aplicativo muito pequeno mostrando a latitude e longitude atuais, o que exigiu que eu adicionasse duas dependências no pubspec.yaml: -
location e simple_permissions para obter a localização atual do usuário e solicitar permissão de localizaçã
mas quando eu executei o aplicativo, ele mostra o seguinte erro: -
Gradle task 'assembleDebug'...
D8: Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/4.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/13.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/14.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/16.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/17.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/18.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/20.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/21.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/23.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/24.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/25.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/26.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/27.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/28.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/29.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/30.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/32.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/33.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/35.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/36.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/38.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/39.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/41.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/42.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/44.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/45.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/46.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/47.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/48.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/49.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/50.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/51.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/52.jar, /home/letsdoit/IdeaProjects/location/build/app/intermediates/transforms/dexBuilder/debug/53.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
Finished with error: Gradle task assembleDebug failed with exit code 1
Eu acho que é por causa da adição de uma biblioteca duas vezes, mas eu não estou adicionando dependências manualmente, por isso é um erro de vibração dentr
Por favor, diga-me a solução dele
Output Of ./gradlew app: dependecies é o seguinte: -
+--- project :location
| \--- com.google.android.gms:play-services-location:15.+ -> 15.0.1
| +--- com.google.android.gms:play-services-base:[15.0.1,16.0.0) -> 15.0.1
| | +--- com.google.android.gms:play-services-basement:[15.0.1] -> 15.0.1
| | | \--- com.android.support:support-v4:26.1.0 -> 27.1.1
| | | +--- com.android.support:support-compat:27.1.1
| | | | +--- com.android.support:support-annotations:27.1.1
| | | | \--- android.arch.lifecycle:runtime:1.1.0
| | | | +--- android.arch.lifecycle:common:1.1.0
| | | | \--- android.arch.core:common:1.1.0
| | | +--- com.android.support:support-media-compat:27.1.1
| | | | +--- com.android.support:support-annotations:27.1.1
| | | | \--- com.android.support:support-compat:27.1.1 (*)
| | | +--- com.android.support:support-core-utils:27.1.1
| | | | +--- com.android.support:support-annotations:27.1.1
| | | | \--- com.android.support:support-compat:27.1.1 (*)
| | | +--- com.android.support:support-core-ui:27.1.1
| | | | +--- com.android.support:support-annotations:27.1.1
| | | | +--- com.android.support:support-compat:27.1.1 (*)
| | | | \--- com.android.support:support-core-utils:27.1.1 (*)
| | | \--- com.android.support:support-fragment:27.1.1
| | | +--- com.android.support:support-compat:27.1.1 (*)
| | | +--- com.android.support:support-core-ui:27.1.1 (*)
| | | +--- com.android.support:support-core-utils:27.1.1 (*)
| | | +--- com.android.support:support-annotations:27.1.1
| | | +--- android.arch.lifecycle:livedata-core:1.1.0
| | | | +--- android.arch.lifecycle:common:1.1.0
| | | | +--- android.arch.core:common:1.1.0
| | | | \--- android.arch.core:runtime:1.1.0
| | | | \--- android.arch.core:common:1.1.0
| | | \--- android.arch.lifecycle:viewmodel:1.1.0
| | \--- com.google.android.gms:play-services-tasks:[15.0.1] -> 15.0.1
| | \--- com.google.android.gms:play-services-basement:[15.0.1] -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| +--- com.google.android.gms:play-services-places-placereport:[15.0.1,16.0.0) -> 15.0.1
| | \--- com.google.android.gms:play-services-basement:[15.0.1,16.0.0) -> 15.0.1 (*)
| \--- com.google.android.gms:play-services-tasks:[15.0.1,16.0.0) -> 15.0.1 (*)
+--- project :simple_permissions
| \--- com.android.support:support-v4:27.1.1 (*)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.71
\--- org.jetbrains.kotlin:kotlin-stdlib:1.2.71
+--- org.jetbrains.kotlin:kotlin-stdlib-common:1.2.71
\--- org.jetbrains:annotations:13.0
build.gradle para o meu aplicativo é o seguinte: -
//noinspection GradleCompatible
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "ab"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.android.support:multidex:1.0.3"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
pubspec.yaml: -
name: a
description: b
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
permission_handler: ^2.2.0
location: ^2.0.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages