本文介绍了如何解决Flutter中的Gradle GooglePlayServices版本错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在android studio中收到Google Play服务错误,并且正在使用Flutter.我尝试了各种解决方案,但似乎无济于事.

I am getting a google play services error in android studio and i am using flutter. I have tried various solutions but nothing seems to work.

我试图更改googleplayservices的版本,但版本相同.

I have tried to change the version of googleplayservices but its the same.

Failed to capture fingerprint of input files for task
':app:checkDebugClasspath' property 'compileClasspath' during up-to-date
check.
> In project 'app' a resolved Google Play services library dependency
depends on another at an exact version (e.g. "[15.0.
1]", but isn't being resolved to that version. Behavior exhibited by the
library will be unknown.

Dependency failing: com.google.android.gms:play-services-flags:15.0.1 ->
com.google.android.gms:play-services-basement@[
15.0.1], but play-services-basement version was 16.0.1.

The following dependencies are project dependencies that are direct or have
transitive dependencies that lead to the art
ifact with the issue.
 -- Project 'app' depends on project 'firebase_auth' which depends onto
com.google.firebase:firebase-auth@16.0.2
 -- Project 'app' depends on project 'firebase_core' which depends onto
com.google.firebase:firebase-core@16.0.4
 -- Project 'app' depends on project 'cloud_firestore' which depends onto
com.google.firebase:firebase-firestore@17.1.1
  -- Project 'app' depends on project 'firebase_storage' which depends onto
com.google.firebase:firebase-storage@15.+
 -- Project 'app' depends on project 'google_sign_in' which depends onto
com.google.android.gms:play-services-auth@16.0.1

 For extended debugging info execute Gradle from the command line with
./gradlew --info :app:assembleDebug to see the dep
 endency paths to the artifact. This error message came from the google-
services Gradle plugin, report issues at https://
  github.com/google/play-services-plugins and disable by adding
"googleServices { disableVersionCheck = false }" to your b
  uild.gradle file.

build.gradle(app)

build.gradle(app)

 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 27


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.news"
    minSdkVersion 16
    multiDexEnabled true
    targetSdkVersion 27
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    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 {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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'
implementation 'com.android.support:multidex:1.0.3'
}

apply plugin: 'com.google.gms.google-services'

build.gradle/project

build.gradle/project

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

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

allprojects {
repositories {
    google()
    jcenter()
}
ext {
    global_version_firebase = '16.0.+'
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}

pubspec.yaml

pubspec.yaml

name: news
description: 'A new Flutter application.'
version: 1.0.0+1
environment:
sdk: '>=2.0.0-dev.68.0 <3.0.0'
dependencies:
flutter:
    sdk: flutter
cupertino_icons: ^0.1.2
http: null
share: null
connectivity:
url_launcher:
cloud_firestore:
rxdart:
firebase_auth: ^0.5.19
google_sign_in:
date_format:
intl:
firebase_storage: ^0.3.7
image_picker:

dev_dependencies:
flutter_test:
    sdk: flutter
flutter:
uses-material-design: true
assets:
    - images/logo.jpg
    - images/fb.jpg
    - images/back.jpg
    - images/google.jpg

请帮助我解决此错误.谢谢

please help me to solve this error.Thank you

推荐答案

问题实际上源于此一种依赖关系:

the issue actually stems from this one dependency here:

Project 'app' depends on project 'firebase_storage' which depends onto
com.google.firebase:firebase-storage@15.+

这意味着pubspec.yaml需要更新此依赖项:

this means, that pubspec.yaml needs this one dependency updated:

firebase_storage: ^1.0.4

作为1.0.4文档声明状态,bump Android dependencies to latest.

这篇关于如何解决Flutter中的Gradle GooglePlayServices版本错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 08:27