Ошибки разрешения зависимостей с приложением firebase flutter - PullRequest
0 голосов
/ 14 июля 2020
• 1000
buildscript
    repositories {
        google()
        jcenter()
    }

    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                        && !details.requested.name.contains('multidex') ) {
                    details.useVersion "27.1.1"
                }
                if (details.requested.group == 'androidx.core'
                        && !details.requested.name.contains('androidx') ) {
                    details.useVersion "1.0.1"
                }
            }
        }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.google.gms:google-services:4.3.3'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven{
            url "https:/maven.google.com"
        }
    }
}

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:

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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.tutrconnect"
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }

}

flutter {
    source '../..'
}

dependencies {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.1.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.1.0-alpha4'
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-messaging:20.1.5'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.android.gms:play-services-auth:18.0.0'
}
apply plugin: 'com.google.gms.google-services'

pubspe c .yaml:

name: tutr_connect
description: A new Flutter project.

# 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.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  shared_preferences:
  cloud_firestore: ^0.9.7+2
  image_picker: ^0.6.0+2
  firebase_storage: ^2.1.0+1
  firebase_auth: ^0.8.3
  google_sign_in: ^4.0.1+1
  geolocator: 5.0.1
  uuid: ^2.0.0
  image: ^2.0.7
  animator: 0.1.4
  cupertino_icons: ^0.1.2
  path_provider: ^0.5.0+1
  firebase_messaging: ^4.0.0+1
  timeago: 2.0.17
  cached_network_image: ^2.0.0-rc
  flutter_svg: any

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_launcher_icons: ^0.7.0
  
flutter_icons:
  image_path: 'assets/images/icon.png'
  android: true
  ios: true
    


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/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:
    - assets/images/
  #  - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/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: Raleway
       fonts:
         - asset: assets/fonts/Raleway/Raleway-Regular.ttf
         - asset: assets/fonts/Raleway/Raleway-Italic.ttf
           style: italic
         - asset: assets/fonts/Raleway/Raleway-Bold.ttf
           weight: 700
         - asset: assets/fonts/Raleway/Raleway-BoldItalic.ttf
           style: italic
           weight: 700
         - asset: assets/fonts/Raleway/Raleway-Thin.ttf
           weight: 200
         - asset: assets/fonts/Raleway/Raleway-ThinItalic.ttf
           style: italic
           weight: 200

     - family: Signatra
       fonts:
         - asset: assets/fonts/Signatra.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

В нем говорится, что существует повторяющийся класс, но до сих пор я пытался удалить аналитику firebase, аутентификацию сервисов воспроизведения и ядро ​​firebase.

Ответы [ 2 ]

0 голосов
/ 15 июля 2020

Я решил проблему, запустив flutter pub cache repair, затем flutter clean и, наконец, flutter run

0 голосов
/ 14 июля 2020
  1. Удалить implementation 'com.google.firebase:firebase-core:16.0.1'
  2. Сделайте flutter clean
  3. Если вы используете Android Studio, также сделайте Invalidate cache / restart
  4. Попробуйте для повторной сборки

(мой ответ основан на этой проблеме на github )

...