Hello everyone,
i'm building an application which is using the following main packages:
- google_sign_in: ^3.0.4
- firebase_auth: ^0.5.15
- cloud_firestore: ^0.7.4
However, when i try to build and run the project with "flutter run" the compile process fails with the following error message:
Launching lib/main.dart on Samsung Galaxy S8, 8 0, API 26, 1440x2960 in debug mode...
Initializing gradle... 4.4s
Resolving dependencies... 36.1s
Running 'gradlew assembleDebug'...
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 12m 28s
Gradle build failed: 1
most search results for the above error suggests conflicting Google play services version. although i'm using the latest version of the above packages (as of writing this) which should not conflict with each other.
anyone has any clue to what am i doing wrong?
Flutter doctor output:
[√] Flutter (Channel beta, v0.5.1, on Microsoft Windows [Version 10.0.17134.165], locale en-US)
• Flutter version 0.5.1 at D:\3rd Party\Repos\flutter stuff\flutter
• Framework revision c7ea3ca377 (2 months ago), 2018-05-29 21:07:33 +0200
• Engine revision 1ed25ca7b7
• Dart version 2.0.0-dev.58.0.flutter-f981f09760
[!] Android toolchain - develop for Android devices (Android SDK 26.0.2)
• Android SDK at D:\Android\sdk-8-9-2017
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 26.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
X Android license status unknown.
[√] Android Studio (version 3.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 23.2.1
• Dart plugin version 171.4424
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[!] VS Code, 32-bit edition (version 1.25.1)
• VS Code at C:\Program Files (x86)\Microsoft VS Code
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected devices (1 available)
• Samsung Galaxy S8, 8 0, API 26, 1440x2960 • 192.168.64.101:5555 • android-x86 • Android 8.0.0 (API 26)
! Doctor found issues in 2 categories.
pubspec.yaml file:
name: lost_found_flutter
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
cupertino_icons: any
http: ^0.11.3+16
cached_network_image: ^0.4.1+1
connectivity: ^0.3.1
url_launcher: ^3.0.3
shared_preferences: ^0.4.2
font_awesome_flutter: ^7.1.0
flutter_spinkit: ^2.0.0
fluro: ^1.3.1
google_sign_in: ^3.0.4
firebase_auth: ^0.5.15
cloud_firestore: ^0.7.4
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
android/build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// this is for google firebase infrastructure
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
android/app/build.gradle file:
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.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.theawkwardprogrammer.lostandfound"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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 {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'
any help is much appreciated.