Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
449 views
in Technique[技术] by (71.8m points)

android - Could not determine the dependencies of task ':firebase_core:compileDebugAidl'

I'm using flutter to build an app for IOS and Android. Just added Firebase_Auth functionality which works perfectly on IOS. However, when I try to run the app on an Android emulator I get the following error:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':firebase_core:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':firebase_core:debugCompileClasspath'.
   > Could not find com.google.firebase:firebase-common:.
     Required by:
         project :firebase_core

* 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 3s
Exception: Gradle task assembleDebug failed with exit code 1

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.")
}

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: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 29

    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 "com.example.testing"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.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"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.3.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

rootProject.ext {
  set('FlutterFire', [
    FirebaseSDKVersion: '25.12.0'
  ])
}

android/build.gradle file:

buildscript {
    ext.kotlin_version = '1.3.71'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.4'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
    }
}

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
}

pubspec.yaml dependencies:

dependencies:
  flutter:
    sdk: flutter

  google_maps_flutter: ^1.0.6

  firebase_core: "^0.7.0"

  firebase_analytics: ^7.0.1
  firebase_auth: ^0.20.0+1
  firebase_dynamic_links: ^0.7.0+1
  cloud_firestore: ^0.16.0
  
  google_sign_in: ^4.5.9

  # 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

flutter doctor -v output:

[?] Flutter (Channel beta, 1.25.0-8.3.pre, on macOS 11.1 20C69 darwin-x64, locale en-NZ)
    ? Flutter version 1.25.0-8.3.pre at /Users/.../Developer/flutter
    ? Framework revision 5d36f2e7f5 (9 days ago), 2021-01-14 15:57:49 -0800
    ? Engine revision 7a8f8ca02c
    ? Dart version 2.12.0 (build 2.12.0-133.7.beta)

[?] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ? Android SDK at /Users/.../Library/Android/sdk
    ? Platform android-29, build-tools 29.0.3
    ? Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    ? Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    ? All Android licenses accepted.

[?] Xcode - develop for iOS and macOS
    ? Xcode at /Applications/Xcode.app/Contents/Developer
    ? Xcode 12.3, Build version 12C33
    ? CocoaPods version 1.10.0

[?] Android Studio (version 3.6)
    ? Android Studio at /Applications/Android Studio.app/Contents
    ? Flutter plugin version 45.1.1
    ? Dart plugin version 192.7761
    ? Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[?] VS Code (version 1.52.1)
    ? VS Code at /Applications/Visual Studio Code.app/Contents
    ? Flutter extension version 3.18.1

[?] Connected device (1 available)
    ? sdk gphone x86 (mobile) ? emulator-5554 ? android-x86 ? Android 10 (API 29) (emulator)

? No issues found!

I have spent so much time trying to fix this, please help!

question from:https://stackoverflow.com/questions/65869495/could-not-determine-the-dependencies-of-task-firebase-corecompiledebugaidl

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This GitHub Issue showed the solution.

Updating the Firebase SDK in android/app/build.gradle worked for me:

rootProject.ext {
  set('FlutterFire', [
    FirebaseSDKVersion: '26.3.0'
  ])
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...